multiple vendors

  • Posts: 37
  • Thank you received: 3
5 years 1 month ago #233928

-- HikaShop version -- : HikaShop Business 2.6.1
-- HikaMarket version -- : 1.6.7
-- Joomla version -- : 3.5.0

Hello,
I do shop for multiple vendors, each vendor will require their own checkout/payment
I turned on one vendor option in the cart
and since in the cart may be goods only one vendor that makes the confusion for customers.
I want to make that the client can initially buy each time only one type of product
1 variant: How I do that one product is replaced by another product if the customer did not buy first?
2 variant: that the products are not being saved in a shopping cart and was always empty

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

  • Posts: 24863
  • Thank you received: 3829
  • MODERATOR
5 years 1 month ago #233969

Hi,

In HikaShop, you have a lot of "trigger" which allow to plug custom plugins for specific behaviors.
For example, you can use the trigger "onBeforeCartUpdate" to control the content of the cart (and the product which is being added) when the customer want to update his cart (add a new product, remove one, change the quantity...).
www.hikashop.com/support/documentation/6...umentation.html#cart

Thanks to that, you can implement the first variant you mentioned.
For the second variant you listed, I'm not sure I understand clearly what you want to achieve.

Regards,


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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 37
  • Thank you received: 3
5 years 1 month ago #234023

Thanks for the answer,
I'm not good at programming but like all did as you said,



but yet function does not work, it is still one product does not substitute another product
and it turns out that if a one item in the cart of the seller and the customer wants to buy another item of another vendor, he can not do that while he did not remove the item from the Cart

plugins/hikashop/cart/cart.php
<?php

defined('_JEXEC') or die('Restricted access');
?><?php
class plgHikashopCart extends JPlugin {
	function plgHikashopCart(&$subject, $config){
		parent::__construct($subject, $config);
	}
	function onBeforeCartUpdate(&$cartClass,&$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&$do) {		
	}
}

Attachments:
Last edit: 5 years 1 month ago by Jerome. Reason: [code] is nice

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

  • Posts: 37
  • Thank you received: 3
5 years 1 month ago #234072

I searched the forum and got the desired code

function onBeforeCartUpdate(&$cartClass,&$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&$do)
  {         
		$cartClass = hikashop_get('class.cart');
                $cartClass->resetCart();
                $cartContent = $cartClass->get();
                $cartClass->updateEntry($quantity,$cartContent,(int)$product_id,1,false,$type,$force);   
  }

Last edit: 5 years 1 month ago by Jerome. Reason: [code] is nice
The following user(s) said Thank You: Jerome

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

  • Posts: 24863
  • Thank you received: 3829
  • MODERATOR
5 years 1 month ago #234090

Hi,

There is no need to perform the hikashop_get for the variable $cartClass because you already have that variable (the first parameter of the function).
And there is also no need to get the cart content (the second parameter) and do the updateEntry (you are currently updating the cart).

Regards,


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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Ilya.bps

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

  • Posts: 261
  • Thank you received: 3
  • Hikamarket Multivendor Hikashop Business
1 month 4 days ago #331623

Hi,

Where can i find the right file to add this code in version 4.1.1
so we also can establish this so cart will be emptied when switching vendor..
Thanks

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

  • Posts: 24863
  • Thank you received: 3829
  • MODERATOR
1 month 3 days ago #331628

Hello,

There is no file to edit, the code is related to the creation of a custom plugin.
For more details regarding the creation of plugins for Joomla, I recommend you the Joomla documentation website :
docs.joomla.org/J3.x:Creating_a_Plugin_for_Joomla

The same trigger would be needed if you want to detect that the customer is added a products from another vendor into a cart which have products from a different vendor.
Afterwards you can use the HIkaShop cart API in order to empty the cart.

But since that thread is 5 years old and your question is not the exact same than the original one, it might be better to create a new thread if you have further questions.

Regards,


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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 261
  • Thank you received: 3
  • Hikamarket Multivendor Hikashop Business
3 weeks 1 day ago #331901

found a setting in the hikamarket, the email is now working..

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

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