Wholesale/Group pricing with Volume limit
15 years 3 months ago #20119
by mindstorm
Wholesale/Group pricing with Volume limit was created by mindstorm
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?
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.
15 years 3 months ago #20128
by nicolas
Replied by nicolas on topic Re: Wholesale/Group pricing with Volume limit
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;
}
$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.
15 years 2 months ago #20921
by mindstorm
Replied by mindstorm on topic Re: Wholesale/Group pricing with Volume limit
Nice Fix! thanks!
Please Log in or Create an account to join the conversation.
15 years 2 months ago #22011
by mindstorm
Replied by mindstorm on topic Re: Wholesale/Group pricing with Volume limit
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
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.
15 years 2 months ago #22015
by mindstorm
Replied by mindstorm on topic Re: Wholesale/Group pricing with Volume limit
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.
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.
15 years 2 months ago - 15 years 2 months ago #22022
by jeffcj
Like my work? Click here to donate.
Your support is appreciated and helps keep me motivated to continue writing code.
Replied by jeffcj on topic Re: Wholesale/Group pricing with Volume limit
mindstorm wrote:
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?
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: 15 years 2 months ago by jeffcj.
Please Log in or Create an account to join the conversation.
15 years 2 months ago #22035
by nicolas
Replied by nicolas on topic Re: Wholesale/Group pricing with Volume limit
If you only want that code for one group of users, you could do something like this:
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.
Code:
$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
}
Please Log in or Create an account to join the conversation.
Time to create page: 0.216 seconds