Wholesale/Group pricing with Volume limit

  • Posts: 69
  • Thank you received: 5
13 years 4 months ago #20119

Currently we have a Wholesale group set up that is working perfectly.

However now we want to have a minimum ITEM purchase of 6. NOT a minimum of 6 units but 1 of our 6 products. So when someone orders a combination of our 6 items, regardless of which product, they will get the discount price.

Maybe a pricing for category?

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 4 months ago #20128

There are no options for that in HikaShop. Thus, the easiest is to edit the file cart of the view checkout via the menu Display->Views and add the code below after the first <?php tag :

$qty = 0;
if(!empty($this->rows)){
foreach($this->rows as $k => $row){
$qty += $row->cart_product_quantity;
}
}
if($qty<6){
$app =& JFactory::getApplication();
$app->enqueueMessage('You need to buy at least 6 products');
$this->nextButton=false;
}

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

  • Posts: 69
  • Thank you received: 5
13 years 4 months ago #20921

Nice Fix! thanks!

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

  • Posts: 69
  • Thank you received: 5
13 years 4 months ago #22011

it seems that when I added this even the NON WHOLESALE users are seeing the 'you need to buy at least 6'..

UGH!!! I don't want this for consumer users?! any idea?

showernichekit.com/index.php/en/products/moderngreek

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

  • Posts: 69
  • Thank you received: 5
13 years 4 months ago #22015

this code that you wrote is what I need for the wholesalers but not for the consumer accounts.

is there a way for the wholesale users to use a different cart file?? that would probably solve the issue.

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

  • Posts: 23
  • Thank you received: 3
13 years 4 months ago #22022

mindstorm wrote:

this code that you wrote is what I need for the wholesalers but not for the consumer accounts.

is there a way for the wholesale users to use a different cart file?? that would probably solve the issue.


Found in another thread that you say you added a 'group' field to the database. It should be easy enough to conditionally exclude the code nicolas provided based on the condition of whether or not the current user is a wholesale user or not. Would that not work?



Like my work? Click here to donate.

Your support is appreciated and helps keep me motivated to continue writing code.
Last edit: 13 years 4 months ago by jeffcj.

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 3 months ago #22035

If you only want that code for one group of users, you could do something like this:

			$do = false;
			$wholesale_group = 20;
			if(version_compare(JVERSION,'1.6.0','<')){
				$my =& JFactory::getUser();
				if(empty($my->id)){
					$group = 29;
				}else{
					$group = $my->gid;
				}
				if($wholesale_group==$group){
					$do = true;
				}
			}else{
				jimport('joomla.access.access');
				$my =& JFactory::getUser();
				$groups = JAccess::getGroupsByUser($my->id, false);
				if(in_array($wholesale_group,$groups)){
					$do = true;
				}
			}
			if($do){
				//code to execute only for the user group with the id 20
			}
And replace the line //code to execute only for the user group with the id 20 by the previous code and the 20 by the id of your wholesale user group.

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

Time to create page: 0.076 seconds
Powered by Kunena Forum