Jump to content

Prestashop 1.6.1.10 Specific prices stop to work


orion_1988

Recommended Posts

I am using Prestashop 1.6.1.10. Everything worked fine and suddenly the specific prices stop to work. When I delete a product with a specific price, all other specific prices stop to show. The price drop controller also stop showing them. The specific prices  are still in the database, but are not calculated in back and front. If I add another specific price to a product, all the specific prices go live again. The prices drop controller also displays them correctly.

 

Can someone point me to some fix or workaround, because I really tried everything what I am capable to do.

 

I already: deleted every cache, disabled unusable modules, searched in forums, digged out the database...etc

 

Any help will be appreciated. 

Link to comment
Share on other sites

I think that I found a workaround for the problem.

 

1. SpecificPrice.php -> function getSpecificPrice -> $query is wrong defined and returns no specific prices, even then there are.

NOT WORKING:

$query = '
SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
FROM `'._DB_PREFIX_.'specific_price`
WHERE
                `id_shop` '.self::formatIntInQuery(0, $id_shop).' AND
                `id_currency` '.self::formatIntInQuery(0, $id_currency).' AND
                `id_country` '.self::formatIntInQuery(0, $id_country).' AND
                `id_group` '.self::formatIntInQuery(0, $id_group).' '.$query_extra.'
AND IF(`from_quantity` > 1, `from_quantity`, 0) <= ';
 
WORKING:
 
 $now = date('Y-m-d H:i:00');
            $query = '
SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
FROM `'._DB_PREFIX_.'specific_price` USE INDEX (id_product_2)
WHERE `id_product` IN (0, '.(int)$id_product.')
AND `id_product_attribute` IN (0, '.(int)$id_product_attribute.')
AND `id_shop` IN (0, '.(int)$id_shop.')
AND `id_currency` IN (0, '.(int)$id_currency.')
AND `id_country` IN (0, '.(int)$id_country.')
AND `id_group` IN (0, '.(int)$id_group.')
AND `id_customer` IN (0, '.(int)$id_customer.')
AND
(
(`from` = \'0000-00-00 00:00:00\' OR \''.$now.'\' >= `from`)
AND
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
)
AND id_cart IN (0, '.(int)$id_cart.')
AND IF(`from_quantity` > 1, `from_quantity`, 0) <= ';
 
 
2.  SpecificPrice.php -> function delete()
 
NOT WORKING 
 
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table']));
 
WORKING
 
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', '1');
 
 

 

 2.  SpecificPrice.php -> function deleteByProductId()

 

NOT WORKING 
 
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table']));
 
WORKING
 
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', '1');
 
 
I think that this will be only a workaround and not an actual fix to the problem. 
 
Any opinions will be appreciated. 
Link to comment
Share on other sites

Hi,

 

many thanks for the reply.

 

As far as I know I do not use any catalog rules. I am using only product specific prices.

 

I also thought that the problem is related to a catalog rule, but I do not use any of them. I want every product to has its own countdown and not to be related to any price, catalog rules.

 

The workaround I described above is still working. I hope it will not break any additional functionality in the future.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...