Developers I need your help to understand a code part of boonex store

 

Hi,

 

I’m currently changing some functions of Boonex Store, to suit my needs.

 

Actually, I have a store where users can manage their quantities for each item published.

 

But i have a problem  to modify the function which display recent items. I want that the items which will be display in store home page are the elements which they have less  1 more quantity available ( I have created a new fields in database -->bx_store_products named "quantity").

 

I'm trying to edit  the method "getBlockCode_Recent()" in "BxStorePageMain.php" by changing

 

return $this->ajaxBrowse('recent', $this->oDb->getParam('bx_store_perpage_main_recent'));

with

return $this->ajaxBrowse('recentAvailable', $this->oDb->getParam('bx_store_perpage_main_recent'));

 

Then I edited the method "AuStoreSearchResult()" in "BxStoreSeachResult.php" and I added a new case in the "switch" :

 

case 'recentAvailable':                                           

                                               $this->aCurrent['restriction']['quantity'] = array('value' => '0', 'field' => 'quantity', 'operator' => '!=');

                $this->sBrowseUrl = 'browse/recentAvailable';

                $this->aCurrent['title'] = _t('_au_store_page_title_browse_recent');

                break;

 

I took the model of "case:'free'",  but it's displaying all items (with items which have 0 quantity).

 

I don't really understand how I can add a filter to display only items which have more than 0 quantity

 

Do you have an idea or a track ?

 

Thank you.

 

Aleks

Alex.
Quote · 14 Dec 2011

When using restrictions, do not make a comparison with zero, it will not work. I usually use greater than or equal to one instead (>=1). See the modified restriction below :

$this->aCurrent['restriction']['quantity'] = array('value' => '1', 'field' => 'quantity', 'operator' => '>=', 'no_quote_value' => true);

Also, notice that I added the 'no_quote_value'.
With 'no_quote_value'=true your condition will evaluate like this : `quantity` >= 1
Without 'no_quote_value' your condition will evaluate like this : `quantity` >= '1'

Paypal email is jeromemingo@gmail.com - http://www.boonex.com/market/posts/modzzz
Quote · 14 Dec 2011

Hi Modzzz,

Great ! It's working by using greater than or equal to one.

And if I understand, 'no_quote_value' is used for INT fields in database.

Thank you for your help ! =)

Alex.
Quote · 14 Dec 2011
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.