Jump to content

Problem with function getPricesDrop


pohodak

Recommended Posts

Hi, I want to see specials for a specific day.

Where I use:

Product::getPricesDrop((int)$this->context->language->id, 0, 20, false, null, null) 

I see all specials. 

 

Where I use for example: 

Product::getPricesDrop((int)$this->context->language->id, 0, 20, false, null, null, '2013-11-28 00:00:00','2013-11-29 00:00:00') 

See all products. Where is the problem?

Link to comment
Share on other sites

  • 11 months later...

Hi, I have the same problem and I think I know where is the problem.

 

Function Product::getPricesDrop has something odd. At first with this piece of code it finds the correct specials within the needed dates

$ids_product = Product::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context);    

But then there is a very strange mysql query part :

'.((!$beginning && !$ending) ? ' AND p.`id_product` IN ('.((is_array($tab_id_product) && count($tab_id_product)) ? implode(', ', $tab_id_product) : 0).')' : '').'

So instead of adding condition to limit the products to ids that were found with first piece of code it just ignores it, because $beginning and $ending won't be false when you search for specific date.

 

I think it is a typo, but maybe there is a hidden meaning behind that code?

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

I have the same problem. I wanted to use beginning and ending arguments of getPricesDrop function to show only limited time promotions but it seams to be impossible with this part of code. 

Found the problem targeted in russian forum, but it is 6 years old... so code chaneged since 2010. Bug? is still here.

 

Can anyone solve this issue?

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...