Boxon Posted September 27, 2013 Share Posted September 27, 2013 Hi! I have this problem, I need to sell same product on different terms, for groups "Customers" and "Pro's". I made product categories by pack size (tanning cream), as different values of attribute "Content" : 1 bottle 200ml, 1 bag 15ml, 1 pack 12 bottles, and 1pack 300 bags Now I should make values "1 pack..." visible only to "Pro's", and small packages visible only to "Customers", but, after 2 days of researching, this looks like a impossible problem. So far, all I could think is to make a new product category, with own package sizes, but that is huge process - 80 products in small and big pack, just enough to go crazy... If anybody has any ideas how to solve this (or rearrange), I will be gratefull. Link to comment Share on other sites More sharing options...
tomerg3 Posted September 27, 2013 Share Posted September 27, 2013 As you said, there is no built in way to do this, only using customization. There are a few ways you can go about doing this, depending on your skill level. The simplest way would probably be by hard-coding some Javascript on the product page, that will remove the options you want to hide based on the customer group. The cleaner option would be to do it in getAttributesGroups() in the product Class Link to comment Share on other sites More sharing options...
Boxon Posted September 27, 2013 Author Share Posted September 27, 2013 Well, I must say that my skill level is total bottom-end beginner. Even worse, client purchased theme that is heavily modified, and lot of things are not where they are supposed to be. So this answer is not really helpful. More ideas, come on guys, wake up... Link to comment Share on other sites More sharing options...
tomerg3 Posted September 27, 2013 Share Posted September 27, 2013 Hire a developer. Link to comment Share on other sites More sharing options...
Dh42 Posted September 27, 2013 Share Posted September 27, 2013 One way that you can do it is duplicate all of your products and categories. Then have the categories set to where you can only see them with the pro group. I have done this on a couple of sites before. Link to comment Share on other sites More sharing options...
Boxon Posted September 27, 2013 Author Share Posted September 27, 2013 Hire a developer. Thank you, you are really great. Fantastic answer for support forum. Link to comment Share on other sites More sharing options...
Boxon Posted September 27, 2013 Author Share Posted September 27, 2013 One way that you can do it is duplicate all of your products and categories. Then have the categories set to where you can only see them with the pro group. I have done this on a couple of sites before. Dh42, thank's for your answer. It came as encouragement after tomerg3's sarcastic answer. I will try to handle this somehow. Can you tell me what you had in mind, to duplicate, but where? Just to make a copy of every product, I had that in mind, actually to create a new product, like Face Cream Box, and to have box of 12 bottles as one product, is that what you had in mind? Small problem is that there is over 80 products in at least 2 packages - 12 bottles, and 300 sachettes, so it's a lot of work... Link to comment Share on other sites More sharing options...
Dh42 Posted September 27, 2013 Share Posted September 27, 2013 I don't think Tomer meant to be snarky, you admitted that you were a bottom end developer with not much experience. It is a valid solution. As for what I said, yes, duplicate them all. 80 products isn't a lot, the last shop I did it to had over 1000 products. Link to comment Share on other sites More sharing options...
Boxon Posted September 28, 2013 Author Share Posted September 28, 2013 There must be a simplest way to do this. Like, somewhere hardcoded JS that says: "If customer is logged as Pro, make path/path/<option value="71" (or first two keys from array) display:none, else display:block". After a little research, I can make that JS, but I don't have a clue where to put it. As I already said, this is my first contact with Prestashop. Tomer gave me a little clue, but it was not not really enough... This is getAttributesGroups function: public function getAttributesGroups($id_lang) { if (!Combination::isFeatureActive()) return array(); $sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_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`, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, pa.`weight`, product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`, pa.`minimal_quantity`, pa.`available_date`, ag.`group_type` FROM `'._DB_PREFIX_.'product_attribute` pa '.Shop::addSqlAssociation('product_attribute', 'pa').' '.Product::sqlStock('pa', '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` '.Shop::addSqlAssociation('attribute', 'a').' WHERE pa.`id_product` = '.(int)$this->id.' AND al.`id_lang` = '.(int)$id_lang.' AND agl.`id_lang` = '.(int)$id_lang.' GROUP BY id_attribute_group, id_product_attribute ORDER BY ag.`position` ASC, a.`position` ASC, agl.`name` ASC'; return Db::getInstance()->executeS($sql); } but I am not sure what to place, and where to place... Link to comment Share on other sites More sharing options...
Arnaudf Posted December 30, 2015 Share Posted December 30, 2015 I encountered the same problem. I also had to create different sub-categories, visible by only certain clients and duplicated duplicated my items to place them in different categories. To avoid duplicating items one by one, I bought StoreCommander module. It allows you to duplicate Categories, subcategories and bunch of products at once. For this reason and many other editing functionalities, I am quite happy about that purchase. Link to comment Share on other sites More sharing options...
Recommended Posts