Juandbbam Posted December 11, 2009 Share Posted December 11, 2009 Hello,At the moment I can choose the default attributes for the Home Featured products. But is there a way of including a drop down menu (like in Products) where the user can choose the product's attributes also in the Home Featured area?Thank you in advance for your help. Link to comment Share on other sites More sharing options...
Simonthetemp Posted December 17, 2009 Share Posted December 17, 2009 I'm looking for the same thing, so let me up! this thread Link to comment Share on other sites More sharing options...
Blakewilliams Posted January 5, 2010 Share Posted January 5, 2010 This is something that I am interested in too....Even better, I would like to have a seperate 'add to cart' button for each of these.Any help is very much appreciated! Link to comment Share on other sites More sharing options...
Simonthetemp Posted January 5, 2010 Share Posted January 5, 2010 Since I posted in this thread, I had a go and tried to develop a module for this.It is still under dev. and I don't have a version to release yet, but I did some nice breakthrough.I am posting regularily on the french forum to get some help on the problems I encounter on this module:http://www.prestashop.com/forums/viewthread/37676/I'll update this thread as soon as I have something to release, and I'm getting there. Link to comment Share on other sites More sharing options...
Blakewilliams Posted January 5, 2010 Share Posted January 5, 2010 As I said in a previous module, I really want to be able to have a buy button for each of the main attrubutes and prices.So from line 235 on 'products.tpl'I need this{if isset($groups)} <!-- attributes --> {foreach from=$groups key=id_attribute_group item=group}{$group.name|escape:'htmlall':'UTF-8'} : {assign var='groupName' value='group_'|cat:$id_attribute_group} {foreach from=$group.attributes key=id_attribute item=group_attribute}{$group_attribute|escape:'htmlall':'UTF-8'} {/foreach} {/foreach} {/if}For each of the home featured items - better still a buy button for each.Its clear to see which variables I need from here, but I'd like someone to help - I have no ideas where this comes from/inherits etc and the system is starting to baffle me a bit.Any help would be amazing.Cheers Link to comment Share on other sites More sharing options...
Simonthetemp Posted January 5, 2010 Share Posted January 5, 2010 hey there, If I got it well, I think I have what you need.Have a look at the module attached, that I just finished a couple of minutes ago !It is to be hooked on the home.It is very basic in terms of layout and styling, but it shows, for each product, a list of its attributes (or to be more precise combinations) with their name and price. But you can customize it, quite easily. You can add more information, such as quantity or weight... And from there you could add an 'add to cart' button. Actually I'm gonna need it as well so I'll keep on working on it, but I'm not sure when I will have time, so you might want to try it yourself.If you need to know what you can display from the template, just add: {$product.combinaisons|print_r} before the loop l.26 enjoyAny help to improve it would be welcome ! homedeclinaisons.zip 1 Link to comment Share on other sites More sharing options...
yumyum Posted January 5, 2010 Share Posted January 5, 2010 Thanks for the module..but I don't have any products revealing? do you know why Link to comment Share on other sites More sharing options...
Simonthetemp Posted January 5, 2010 Share Posted January 5, 2010 Oups I was a bit too impatient to share my piece of work and I forgot what was specific to my setup of prestashop.There is one thing you will have to setup manually in the code so that it displays products: it's a category ID, on l. 30 of homedeclinaisons.php.here is an extract: function hookHome($params) { global $smarty; $category = new Category(6); // A MODIFIER POUR FILTER LA CATEGORIE $nb = 20; // AJOUT Nb de resultats retournés par default l.30 is $category = new Category(6);Instead of 6, put any category id featuring the products you want to show. You may not have any category with this actual ID.The reason why products are displayed depending on one specific category is because I started to develop this module by copying the module homefeatured and then tweaking it. In this original module, products are displayed on the home page because they belong to the main category.This variable being in the module script is a bit tricky.This is something I will improve for my own needs. I think I'll try to improve the module so that one can select the category to display from the backoffice.Thanks Link to comment Share on other sites More sharing options...
yumyum Posted January 6, 2010 Share Posted January 6, 2010 thank you Link to comment Share on other sites More sharing options...
Blakewilliams Posted January 29, 2010 Share Posted January 29, 2010 i think we're thining along the same lines - I can't understand why you would want to bring this data back, but not have a button for each.also, why in one section at the bottom? Link to comment Share on other sites More sharing options...
Simonthetemp Posted February 2, 2010 Share Posted February 2, 2010 here is the latest version (see attached) with one add to cart button per combinationIn order to use the ajax cart you must add a couple of lines of code to allow the JS to spot the id_attribute from the href and use it to update the cart.In modules/blockcart/ajax-cart.js you have (L. 10): ajaxCart.add(idProduct, null, false, this); you have to add instead: var varCombinationHref = "id_product_attribute="; var positionCombinationHref = $(this).attr('href').indexOf(varCombinationHref); if(positionCombinationHref != -1) { var positionCombinationVar = positionCombinationHref + varCombinationHref.length; var positionCombinationFin = $(this).attr('href').indexOf("&",positionCombinationVar); var idCombination = $(this).attr('href').substring(positionCombinationVar,positionCombinationFin); } else { idCombination = null; } ajaxCart.add(idProduct, idCombination, false, this); and that should do it ! v3_homedeclinaisons.zip Link to comment Share on other sites More sharing options...
Blakewilliams Posted February 3, 2010 Share Posted February 3, 2010 Fabulous - as my post suggest on the other thread open for this, I have had success in integrating parts of your code into the 'homefeatured' module on the home page - every item on homefeatured now has a button for all attributes!NEXT hehedoes anybody have any ideas how I could get the attributes buttons on the search result pages.... for example, the page that shows when you click one of the categories down the side, such as 'laptops' - then the category.php?id_category page results of the relevant page appear.I would ideally like to get a button for the three attributes on there too.All help is extremely greatfully recieved!Blake Link to comment Share on other sites More sharing options...
Simonthetemp Posted February 3, 2010 Share Posted February 3, 2010 Hey Blake,I haven't done this yet but I've got an idea of how you might achieve that.All the templates and pages that list products, like te search result page and the category.php page, use themes/prestashop/product-list.tplThe html/smarty code in there looks quite similar to the lines you can find in homefeatured.tpl (and that you modified).so you can try and add your lines or mine and put them in there.The tricky part is to allow the script to use our custom built function getAttributesGroups and this is something that needs to be copied and modified in the php files of each page (which doesn't sound very optimised) or in the class files... Or so I think.I'll try this at some point. If you have any luck with this, feel free to share Link to comment Share on other sites More sharing options...
Blakewilliams Posted February 3, 2010 Share Posted February 3, 2010 Hi SimonI see where you are coming from - I thought I had it for a sec....On line 60 of category.php, I located the smarty array, then wrapped it in a bit of code from 'homedeclinaisons' so that it looked like this:: //Boucle sur les produits pour récupérer leur déclinaisons for($i=0;$i $attributesGroups = $this->getAttributesGroups($current_id_lang,$products[$i]['id_product']); // Insere le tableau des combinaison dans le tableau des produits, en associant chaque produit a son tableau de combinaisons $products[$i]["combinaisons"] = $attributesGroups; } $smarty->assign(array( 'products' => (isset($cat_products) AND $cat_products) ? $cat_products : NULL, 'id_category' => intval($category->id), 'id_category_parent' => intval($category->id_parent), 'return_category_name' => Tools::safeOutput(Category::hideCategoryPosition($category->name)), 'path' => Tools::getPath(intval($category->id), $category->name) )); // AJOUT function getAttributesGroups($id_lang,$id_product) { return Db::getInstance()->ExecuteS(' SELECT ag.`id_attribute_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`, pa.`quantity`, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference` FROM `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group` LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group` WHERE pa.`id_product` = '.intval($id_product).' AND al.`id_lang` = '.intval($id_lang).' AND agl.`id_lang` = '.intval($id_lang).' ORDER BY pa.`id_product_attribute`'); } I thought that i could then access 'combinaisons' in the product array in the product-list.tpl file, but I have had no joy.Kinda moving out of my comfort zone here so any help would be amazing!Blake Link to comment Share on other sites More sharing options...
Blakewilliams Posted February 3, 2010 Share Posted February 3, 2010 hmm i could see that the product variable in the category.php file was actually $cat_products, so I changed the code below so that the function worked off the $cat_products class thinking that this might work... //Boucle sur les produits pour récupérer leur déclinaisons for($i=0;$i $attributesGroups = $cat_products->getAttributesGroups($current_id_lang,$cat_products[$i]['id_product']); // Insere le tableau des combinaison dans le tableau des produits, en associant chaque produit a son tableau de combinaisons $cat_products[$i]["combinaisons"] = $attributesGroups; } No joy again though, simply won't even render the page! Link to comment Share on other sites More sharing options...
Simonthetemp Posted February 3, 2010 Share Posted February 3, 2010 if it doesn't render, it's usually (in most of the case for me anyway) because there is flaw in the syntaxdid you wrote all this code within the if () { } ?if so I would say that you have to move the function declaration out of it.try to put it at the very bottom of the php script.This function shouldn't be sitting here anyway. Link to comment Share on other sites More sharing options...
Blakewilliams Posted February 3, 2010 Share Posted February 3, 2010 hmmmI have tried moving the function to the bottom and out of the way - still no success.I have included my modified category page... maybe you could have a look see if you could see any syntax errors?Huge thanks! category.php Link to comment Share on other sites More sharing options...
Simonthetemp Posted February 3, 2010 Share Posted February 3, 2010 The pb is definitely coming from the call of the function and its position.It appears to me than the best position for this piece of code (the function declaration) should be in the class file ( /classes/Category.php ). Put it at the end and use this to declare it: public function getAttributesGroups($id_lang,$id_product) { ... Then the call of the function was wrong in your file in the for() loop (in category.php):it was: $attributesGroups = $cat_products->getAttributesGroups($current_id_lang,$cat_products[$i]['id_product']); it should be: $attributesGroups = $category->getAttributesGroups($cookie->id_lang,$cat_products[$i]['id_product']); Link to comment Share on other sites More sharing options...
Blakewilliams Posted February 3, 2010 Share Posted February 3, 2010 Progress!I declared a public function as you suggested at the bottom of the category class public function getAttributesGroups($id_lang,$id_product) { return Db::getInstance()->ExecuteS(' SELECT ag.`id_attribute_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`, pa.`quantity`, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference` FROM `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group` LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group` WHERE pa.`id_product` = '.intval($id_product).' AND al.`id_lang` = '.intval($id_lang).' AND agl.`id_lang` = '.intval($id_lang).' ORDER BY pa.`id_product_attribute`'); } Then I tidied up the function call so that it now reads for($i=0;$i $attributesGroups = $category->getAttributesGroups($cookie->id_lang,$cat_products[$i]['id_product']); // Insere le tableau des combinaison dans le tableau des produits, en associant chaque produit a son tableau de combinaisons $cat_products[$i]["combinaisons"] = $attributesGroups; } and now if i type {$product.combinaisons|print_r} in 'product-list.tpl' it returns the relevant values!its rough around the edges, but its a very good start! I now need to extract the correct values and pass them to the cart (i have already managed this on the product page, so I'm hoping that it will be rudimentarily the same) Link to comment Share on other sites More sharing options...
tomerg3 Posted February 3, 2010 Share Posted February 3, 2010 I'm sorry to say, but you may be chasing a lost cause....As you may know, there is a problem with attributes when you have too many combinations for one product.What you are trying to do will potentially increase the number of combinations, so unless you plan on having very few attribute groups with very few items in them, you may end up finding out that your page will break. Link to comment Share on other sites More sharing options...
Simonthetemp Posted February 3, 2010 Share Posted February 3, 2010 Indeed in my case, I do have very few combinations. Link to comment Share on other sites More sharing options...
Blakewilliams Posted February 4, 2010 Share Posted February 4, 2010 I only have one attribute group and max 3 attributes per item.How could this cause me to have any problems? Seems to work fine so far, basically the guy I am doing it for sells health supplements - for example vitamin C - this then comes in 60, 120 & 360 tab bottles.Basically, for all of its whistles and bells, I think that prestashop really fails in this respect - it has taken me a huge amount of time and effort to try to understand how it all workks and then hack pshop.We all know fickle web users can be - if you don't give a person the chance to buy something the second they see it, but rather presume that a user will be willing to navigate a number of clicks into the site until they find and obscure drop down, then you don't have to be a genius to see that conversions will be harmed.I'm quite keen to hear how other people feel about this.Either way, I am extremely thankful to Tomer and Simonthetemp for their priceless help. Link to comment Share on other sites More sharing options...
memex Posted February 16, 2010 Share Posted February 16, 2010 BlakewilliamsI will be very grateful to youi, f you share your working files. Link to comment Share on other sites More sharing options...
Guidiap Posted June 24, 2010 Share Posted June 24, 2010 Up ! Interested in that fact of displaying combinations on the Home Featured side, see my post too (french), thanks Link to comment Share on other sites More sharing options...
gdiloy Posted August 9, 2010 Share Posted August 9, 2010 Hi, I'm changing the code to have a combo-box in the product list, to purchase the combination without enter in the product details.It's not yet solved, but when it was, you can add this functionality to the module.You can follow it (and may be help) in the third page of:http://www.prestashop.com/forums/viewthread/37676/P30/modules_tiers/montrer_les_combinaisons_et_attributs_dans_les_listes_produits/Thanks!! Link to comment Share on other sites More sharing options...
gdiloy Posted August 16, 2010 Share Posted August 16, 2010 Hi everybody,I have the combo box running in the main page (see the code ant explanation in http://www.prestashop.com/forums/viewthread/37676/P30/modules_tiers/montrer_les_combinaisons_et_attributs_dans_les_listes_produits/), but to take the selected value when you push the add-to-cart button it's impossible, once the page is displayed the parameter in the href doesn't change. I've tested referencing he DOM of the select by id in the page, but no way.Someone have any idea how to catch, from a href, the value of the select outside the select itself? Link to comment Share on other sites More sharing options...
gdiloy Posted September 22, 2010 Share Posted September 22, 2010 Hi, I'm changing the code to have a combo-box in the product list, to purchase the combination without enter in the product details.It's not yet solved, but when it was, you can add this functionality to the module.You can follow it (and may be help) in the third page of:http://www.prestashop.com/forums/viewthread/37676/P30/modules_tiers/montrer_les_combinaisons_et_attributs_dans_les_listes_produits/Thanks!! SOLVED!!!Finally I've had time enough. If someone is interested I'll tidi the code and put the files here. Link to comment Share on other sites More sharing options...
Guidiap Posted September 22, 2010 Share Posted September 22, 2010 Yes ! It would be appreciated by the guys here ;-) Just : is it for v1.3.1 ?... and thanks 4 us Link to comment Share on other sites More sharing options...
gdiloy Posted October 17, 2010 Share Posted October 17, 2010 Yes ! It would be appreciated by the guys here ;-) Just : is it for v1.3.1 ?... and thanks 4 us Yes, it's for the 1.3.1sorry for my delay, I'm in a rush these days.I explained le chage in french in the post http://www.prestashop.com/forums/viewthread/37676/P45/modules_tiers/montrer_les_combinaisons_et_attributs_dans_les_listes_produits/If someone needs further explanations just ask me.I attache the file (must do the changes of the previous posts in homedeclinaisons.php, etc..)I hope it helps someone, thank for the module to the creators.homedeclinaisons.txt Link to comment Share on other sites More sharing options...
gdiloy Posted November 11, 2010 Share Posted November 11, 2010 Someone has tried to show the product in pages?In the php and tpl files the number of products to show it's fixed to 20. So, I think it would be very interesting to show it like in a cathegory, it is by pages of n products per page, and the page number in the bottom.Any ideas? Link to comment Share on other sites More sharing options...
kennyh Posted November 11, 2010 Share Posted November 11, 2010 Hi I hope you were able to see this thread hope it help you out http://www.prestashop.com/forums/viewthread/77475/third_party_modules/free_module_show_attributes_and_qauntety_of_a_product_outside_the_product_dot___need_small_change_who_can_do_it__thanks Link to comment Share on other sites More sharing options...
gdiloy Posted November 12, 2010 Share Posted November 12, 2010 Hi I hope you were able to see this thread hope it help you out http://www.prestashop.com/forums/viewthread/77475/third_party_modules/free_module_show_attributes_and_qauntety_of_a_product_outside_the_product_dot___need_small_change_who_can_do_it__thanks Many Tanks, it's very interesting.Now the choose of declinaisons is more or less solved (not the quantity, it's true) with a combo box. I will page the results in the home page. Anyone has tried this? Link to comment Share on other sites More sharing options...
kennyh Posted November 13, 2010 Share Posted November 13, 2010 I have tried this in 1.3.2 and it works very well on the homepage , on the product-list it more difficult . Hope you can figure it outRegards Ken Link to comment Share on other sites More sharing options...
gdiloy Posted November 15, 2010 Share Posted November 15, 2010 I have tried this in 1.3.2 and it works very well on the homepage , on the product-list it more difficult . Hope you can figure it outRegards Ken Well, I'm not a formed programmer in php + js + tpl, so... Any clue? I'm only interested in paging the homepage.I supose I must chage the select that gets the products in the php to put limits, and in the tpl manage the number of items, and the limits also.Well, before all I have to understand how to pass values between those, etc.Advise or pieces of code are wellcome. Link to comment Share on other sites More sharing options...
gdiloy Posted November 16, 2010 Share Posted November 16, 2010 Paging the homepage close to be solved!!! (Presta 1.3.1)I'm on testing, I think it's done in a couple of days. Someone interested? I'll put the code (touched php, tpl) Link to comment Share on other sites More sharing options...
Guidiap Posted November 16, 2010 Share Posted November 16, 2010 Yes, go on dude !! ...and thanks of course. Link to comment Share on other sites More sharing options...
Rixou Posted July 14, 2011 Share Posted July 14, 2011 Thanks a lot for sharing the code. I would like to do this for my attributes anyone help ? Link to comment Share on other sites More sharing options...
chartalex Posted August 1, 2011 Share Posted August 1, 2011 UP! (for 1.4 version) Link to comment Share on other sites More sharing options...
swat3 Posted October 16, 2011 Share Posted October 16, 2011 up! Link to comment Share on other sites More sharing options...
tomerg3 Posted October 16, 2011 Share Posted October 16, 2011 Check out http://www.prestashop.com/forums/topic/79758-module-product-list-attributes-allow-customers-to-select-product-attributes-on-the-category-manufacturer-supplier-and-search-pages/ Link to comment Share on other sites More sharing options...
YesYES12 Posted May 5, 2012 Share Posted May 5, 2012 Hi, Is there anybody to tell me how can I have my attributes like this, I don't need more, I need only something like this. tnx Link to comment Share on other sites More sharing options...
seslichat Posted May 25, 2012 Share Posted May 25, 2012 sesli chat web tasarım rent a car evden eve nakliyat bayrak kombi servisi thnaks admin very good forums.. Link to comment Share on other sites More sharing options...
tsohbet Posted June 10, 2012 Share Posted June 10, 2012 (edited) bence de good ayrıca daha good'u lazımsa şu linke göz atın; sohbet Edited June 10, 2012 by tsohbet (see edit history) Link to comment Share on other sites More sharing options...
jincmd Posted December 10, 2012 Share Posted December 10, 2012 what is this jibberish? I would like this module as well Link to comment Share on other sites More sharing options...
Laurentino Posted February 1, 2013 Share Posted February 1, 2013 HI. What i want is really a simple feature, but i don't know how to do it. If my products does not have attributes, you should see the button to "Add to cart". If they have attributes, you should see a button "Configure Product" with a link to the product page. How to achieve this? Link to comment Share on other sites More sharing options...
gamelear Posted February 20, 2017 Share Posted February 20, 2017 very good,Ondokuz Mayıs Üniversitesi Forum Sayfası 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