MEG Venture Posted June 27, 2010 Share Posted June 27, 2010 This post is for PS v.1.2.5 users, don't try it without a backup of required files.Mine is a primitive solution but I wanted to share it with you. I wanted a B2B solution for my retailers and wanted them to have special discounted prices when they log in. I wanted them to be able to see the end user prices as well. To do that:1. Create a new user group from BO under Customers>Groups and assigned them a 45% discount.2. Root>init.php, find this code // Init Cookie $cookie = new Cookie('ps'); and change it with the code below // Init Cookie $cookie = new Cookie('ps'); $customer = new Customer(intval($cookie->id_customer)); $trade = $customer->isMemberOfGroup(2); $smarty->assign('trade', $trade); (Thanks to rocky!)3. Open themes>your_theme>product.tpl and just before {if $packItems|@count} add this code: {if $trade} {l s='END USER:'}{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)/$group_reduction}{if $priceDisplay == 2} {l s='-Tx'}{/if} {/if} This was for your detailed product pages.4. Open themes>your_theme>product-list.tpl and just before {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} add this code: {if $trade} {l s='END USER:'}{displayWtPrice p=$product.orderprice}{if $priceDisplay == 2} {l s='-Tx'}{/if} {/if} 5. Open modules>homefeatured>homefeatured.tpl and just before {l s='View' mod='homefeatured'} add this code: {if $trade} {l s='END USER:' mod='homefeatured'}{convertPrice price=$product.orderprice}{if $priceDisplay == 2} {l s='-Tx' mod='homefeatured'}{/if} {/if} That's all!!!* If you want to ignore product discount if there is already a group discount applied, or vice versa see:Changing Discount Policies* If you want to put a message special to this group, then open root>header.tpl and change this code: <title>{$meta_title|escape:'htmlall':'UTF-8'}</title> with this one: {if $trade} <title>{$meta_title|escape:'htmlall':'UTF-8'} Your message</title> {else} <title>{$meta_title|escape:'htmlall':'UTF-8'}</title> {/if} * I still couldn't find a solution to hide particular blocks from a group. If you find a way please let me know.* Additionally, I couldn't find how to edit best-sales.tpl, new-products.tpl and prices-drop.tpl, yet. The end user prices are displayed as "0" and I don't know, why.Please correct my codification and leave your feedbacks if you come up with any other improvements.Thank you. ;-) Caglar Link to comment Share on other sites More sharing options...
Clara Posted July 7, 2010 Share Posted July 7, 2010 Hi Caglar, this seems working :-)I have another question: If I would like a Group 2 customers not to have access to Product Details ( only product-list and in categories ) what should I change? I guess I shoudl start with init.php file and change the code related to cookie to sthg like this:if cutomer 2 than in product-list do not show the Link that leads to product details ( product page ) Can you help me with that?Thanks! Link to comment Share on other sites More sharing options...
MEG Venture Posted July 8, 2010 Author Share Posted July 8, 2010 Dear Clara,There are many other links referring to product detail pages. Like search, specials modules, featured products module, etc. I will take a look at it and let you know if I can find an answer... Link to comment Share on other sites More sharing options...
MEG Venture Posted July 8, 2010 Author Share Posted July 8, 2010 I haven't tested this solution, yet. Please have a backup of your related files before changing.First change is on init.php. Open it and find (number 6 may change as goup id changes when you add/delete a new one) $cookie = new Cookie('ps'); $customer = new Customer(intval($cookie->id_customer)); $trade = $customer->isMemberOfGroup(6); $smarty->assign('trade', $trade); right below of this code add the second group by adding this code: $customer = new Customer(intval($cookie->id_customer)); $trade1 = $customer->isMemberOfGroup(7); $smarty->assign('trade1', $trade1); Now in product-list.tpl, find {if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if} getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" /> {if $product.new == 1}{l s='new'}{/if}{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'} {$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'} and change with {if $trade1} {if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if} getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" /> {if $product.new == 1}{l s='new'}{/if}{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'} {$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'} {else} {if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if} getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" /> {if $product.new == 1}{l s='new'}{/if}{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'} {$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'} {/if} and change this code {l s='View'} with this one {if $trade1} {l s='Act Now!'} {else} {l s='View'} {/if} If this solution works for you please let me know. Thanks ;-) Link to comment Share on other sites More sharing options...
Clara Posted July 8, 2010 Share Posted July 8, 2010 Thanks! I 'll try and let you know :-) 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