Jump to content

g0nzo

Members
  • Posts

    18
  • Joined

  • Last visited

Profile Information

  • Location
    Calgary
  • Activity
    Web development agency

g0nzo's Achievements

Newbie

Newbie (1/14)

2

Reputation

  1. In 1.4.7.3 it's not a rounding issue - its an actual logic issue when calculating provincial tax. There are 2 different if/else blocks that deal with the $nTax variable. I removed both blocks and only use the calculation under the original if() statement to properly calculate taxes on products/shipping in Canada/US.
  2. I thought you were messing with me! But I know how you feel. There is another option too, of course. Since these are only tiny modifications, you could just modify the core file and make a note as well as comment the code so you can easily 'grep' for it when upgrading. Really we're only adding a function and not changing an existing one, so its not a big deal.
  3. Hey CodeDog - Note there is a difference between PRODUCT.PHP (this is the one we want) and PRODUCTS.PHP - You are referring to it differently in every post so you should check to be sure you are in the right file. Failing that you could try putting it in its own class, perhaps by inheriting the Product class. Not sure if that will work though. Good luck!
  4. I think you're right. I assume the initial reference (below) is just a typo to keep me on my toes? If you already have a override/classes/product.php, just add a public function to it. // this function gets original price in the DB public function getOriginalPrice($id) { return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `price` FROM `'._DB_PREFIX_.'product` WHERE `id_product` = '.(int)($id)); } Then you can copy ProductController.php to override, and add the 1 line of code in the appropriate spot. (near line 320 in latest PS version; add to the array that is assigning the smarty template variables). As before, if it already exists, just modify it. // setting original price var 'originalPrice' => Product::getOriginalPrice($this->product->id), Then modify the tpl file to show the original price as I did in the original post.
  5. Hey CodeDog. You need to create the "Product.php" file because its going to extend another class. It would be created in override/classes. Your "Products.php" file doesn't need to be touched and is not related to this.
  6. Gents, I just installed a fresh copy of 1.5.3.1 - My solution will work with some minor tweaks. You can PM me if you want me to fix your specific install. It still depends on using the 'Fixed Price' rather than a % or amount based discount. @CodeDog - The code you need to modify is still in the same file; it is not buried in third party modules as you previously wrote.
  7. @CodeDog, any luck? If not, I might have time to look at this tonight with a fresh install of 1.5.3.
  8. @CodeDog if it doesn't work in 1.5.2 it wouldn't take much to bring it up to speed. Product.php - this file only contains 1 function to get the original price from the DB ProductController.php - I believe I've only added one line of code (line 152) as per the code comment I left. I copied everything from the core file ProductController.php. So for 1.5.2 simply see if the structure is similiar (and do the same) or search for the smarty assignment that existed in the version I was using. Then, modify the template similar to what I've done in my version. If you need more help PM me. I don't have a development version of 1.5.2 running to test out.
  9. It won't be an issue using those two variables together. The specific price should be set in this object: $product->specificPrice If you disable those overrides do the per province tax rules function? I've checked through the code and nothing modifies tax rules that I could see. Try this first to verify this is the issue.
  10. Aren't you putting the item on sale by using the Specific Price functionality? Or are you putting something on sale using the "On Sale" checkbox in the admin?
  11. The easiest way would likely be to set the attribute price to 0 when the specific price variable is set. I can't verify as I don't have a PS development environment setup but it might be in the foreach loop around line 240 of ProductController.php: $combinations[$row['id_product_attribute']]['price'] = (float)($row['price']); I am thinking at the bottom of this loop you can do a simple IF statement to see if the specific price variable is set. If true, then something like this may work: $combinations[$row['id_product_attribute']]['price'] = 0;
  12. I managed to tackle this without modifying too much Prestashop code. The Prestashop team has gone to great lengths to make sure this product is usable in many different countries, however this method of tax calculation is not used in many countries, including US and Canada. Prestashop should consider making this a configurable option. In this case it helps anyone, see the below post for a workaround on using specific price reductions and getting tax calculations on the reduced price: http://www.prestashop.com/forums/index.php?/topic/174302-specific-price-tax-included/page__view__findpost__p__886892
  13. I found a way to do this specific to my needs and want to share in case it helps anyone else. Tested on version 1.4.7. If anyone knows of a more efficient way, please let me know! This is for developers who want to use the specific price functionality,live in a country where tax only needs to be calculated on the reduced price, and cannot use the percentage based discount because it affects price impacts in product combinations. 1. Add a new specific price. Then simply enter your desired sale price (pre tax, of course) into the "Product Price" field. Don't use the percentage or amount price reduction. 2. Drop the 2 attached files into your /override folder: Product.php --> /override/classes Product.php ProductController --> /override/controllers ProductController.php 3. Add these lines somewhere in your product.tpl to show the original price: {if $product->specificPrice AND $originalPrice > $productPrice} <p id="old_price">Original Price:{convertPrice price=$originalPrice}</p> {/if}
  14. :-) That's what I feel like doing!! Except I am also using a 'combination' dropdown that modifies the price and the % discount is discounting that too, which I do not want.
×
×
  • Create New...