Skip to main content

Remove add to cart button depending on the vendor

12 years 5 months ago #160619 by activha
Hello

Is it possible to remove the add to cart button and the stock display for a product depending on the group of the vendor ?

ex : make that for all vendors belonging to group 'A' add to cart button and stock are not displayed ?

Which template should be edited ?

For instance can I add something with
if ( $vendor->user->usertype == "Registered" ) , then display or not

Thanks
Jean

Please Log in or Create an account to join the conversation.

12 years 5 months ago #160621 by Jerome
Hi,

In the HikaShop product views (product page and product listing) you have access to the product's vendor object.

So you can modify the view "product | quantity" to display or not the "add to cart" button or the stock depending the vendor.
You shoud use
Code:
$this->row->vendor
to access to the vendor of the processing product (if you are in a listing, the quantity view will be call for each product).

The vendor group is stored with the vendor access
Code:
$access = $this->row->vendor->vendor_access; if(is_string($access)) $access = explode(',', $access); if(in_array('@3', $access)) { // @3 means the group with the id 3. // the vendor is in the group 3. Do some special stuff }
The accesses starting with a @ are groups, otherwise it indicate the HikaMarket right (like "product_edit" or "order_listing").

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

12 years 5 months ago #161174 by activha
Thanks seems to work great...

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.082 seconds
Powered by Kunena Forum