hurray Posted October 27, 2015 Share Posted October 27, 2015 Hi, I am using prestashop 1.5.6.2. On my promotion block that appears on the right-hand side of the webiste, right now there are 3 products that get displayed. These products do not change at all, no matter how many times I refresh my browser. On top of that, 2 of the products on the block at the most expensive products that are on promotion. I do not want them to show there. How can I randomize the products that show in this block? Link to comment Share on other sites More sharing options...
NemoPS Posted October 28, 2015 Share Posted October 28, 2015 What's the exact name of the "promotion block"? Link to comment Share on other sites More sharing options...
hurray Posted October 29, 2015 Author Share Posted October 29, 2015 It is called "Bloc promotions" developed by prestashop. It is a french website. Link to comment Share on other sites More sharing options...
NemoPS Posted October 30, 2015 Share Posted October 30, 2015 I wonder if it's blockspecials. Can you check if it reads 'blockspecials' somewhere in the url, when you access the configuration page? Link to comment Share on other sites More sharing options...
hurray Posted October 30, 2015 Author Share Posted October 30, 2015 Hi Nemo1, Sorry I was wrong. It is actually called "Multiple Specials block". Link to comment Share on other sites More sharing options...
NemoPS Posted October 31, 2015 Share Posted October 31, 2015 Hmmm there is no such block by default, so it's hard to guide you. Did you buy it? Or is it a free module? Link to comment Share on other sites More sharing options...
hurray Posted November 1, 2015 Author Share Posted November 1, 2015 It is a default module. It must be blockspecials. Link to comment Share on other sites More sharing options...
NemoPS Posted November 2, 2015 Share Posted November 2, 2015 Ah, I see. THat module displays one product only in the column, by default. Did you alter it? It should display a random special by default, as you said Link to comment Share on other sites More sharing options...
hurray Posted November 4, 2015 Author Share Posted November 4, 2015 Hi Nemo, please look at the right-hand side on my homepage http://www.savdana.com/. The block that is all the way at the bottom is called "Promotions" and it displays 3 products and sorts them "High-to-Low" according to the price. I would like them to sort eithr "Low-to-High" pricewise or randomly. Whichever can be done easily will be fine with me. May be this makes it clearer to you now. Link to comment Share on other sites More sharing options...
NemoPS Posted November 4, 2015 Share Posted November 4, 2015 It does look like blockspecials, but it should really display only 1 product by default. Check blockspecials,php, see what it does for hookDisplayRightColumn Link to comment Share on other sites More sharing options...
hurray Posted November 4, 2015 Author Share Posted November 4, 2015 Hi Nemo, Finally I figured out the name of this block. It is "Multiple Specials block". ON the back-end the number of product to display is set to 3. Now here is what I have in blockmultiplespecials.php for hookRightColumn public function hookRightColumn($params) { $nbr=Configuration::get('BLOCKSPECIALS_NBR'); $products = Product::getPricesDrop($this->context->language->id, 0, $nbr, false); $this->smarty->assign(array( 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), )); return $this->display(__FILE__, 'blockmultiplespecials.tpl'); } Link to comment Share on other sites More sharing options...
NemoPS Posted November 6, 2015 Share Posted November 6, 2015 You can add a further parameter for the order by public static function getPricesDrop($id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, $beginning = false, $ending = false, Context $context = null)I guess you want to set that to price? Then add 'asc' as next parameter as well Link to comment Share on other sites More sharing options...
hurray Posted November 7, 2015 Author Share Posted November 7, 2015 Hi Nemo, Where do I put your code and where do I add the paramete "asc"? I am not good at coding. Thanks in advance. Link to comment Share on other sites More sharing options...
hurray Posted November 15, 2015 Author Share Posted November 15, 2015 Hi Nemo, Do you mind helping? Please. Link to comment Share on other sites More sharing options...
NemoPS Posted November 16, 2015 Share Posted November 16, 2015 The one you linked earlier, just add parameters till you reach the "order way", should be the sixth Link to comment Share on other sites More sharing options...
hurray Posted November 17, 2015 Author Share Posted November 17, 2015 Oh yeah, that helps a lot It was easier asking for help for some questions during exams from some of my professors than it is from you I already told you, I suck at coding. Link to comment Share on other sites More sharing options...
hakeryk2 Posted September 14, 2016 Share Posted September 14, 2016 Well, I tried a lot of times to get it working with random way but I gave up. My solution is to show the products in date update DESC to show last edited promotions. My working code is getPricesDrop((int)$params['cookie']->id_lang, 0, Configuration::get('BLOCKSPECIALS_SPECIALS_NBR'), 0, 'date_upd', 'DESC'); but I tried with getPricesDrop((int)$params['cookie']->id_lang, 0, Configuration::get('BLOCKSPECIALS_SPECIALS_NBR'), 0, 'name', 'RAND'); or getPricesDrop((int)$params['cookie']->id_lang, 0, Configuration::get('BLOCKSPECIALS_SPECIALS_NBR'), 0, 'name', 'RAND()'); but none of these worked - any help to get this random? Link to comment Share on other sites More sharing options...
NemoPS Posted September 14, 2016 Share Posted September 14, 2016 Rand must be order by, not waygetPricesDrop((int)$params['cookie']->id_lang, 0, Configuration::get('BLOCKSPECIALS_SPECIALS_NBR'), 0,'RAND()'); Link to comment Share on other sites More sharing options...
hakeryk2 Posted September 14, 2016 Share Posted September 14, 2016 Well, none of theese working either: getPricesDrop((int)$params['cookie']->id_lang, 0, Configuration::get('BLOCKSPECIALS_SPECIALS_NBR'), 0, 'RAND()'); is giving lot of print_r arrays/objects on page getPricesDrop((int)$params['cookie']->id_lang, 0, Configuration::get('BLOCKSPECIALS_SPECIALS_NBR'), 0, 'RAND'); is giving SQL error Unknown column 'RAND' in 'order clause' and the end of query looks like this ORDER BY RAND DESC LIMIT 0, 12 I just trully don't know the reason :/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now