News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Multiple Quantity Question

Started by team, April 26, 2012, 16:27:40 PM

Previous topic - Next topic

Milbo

Hmmm, sorry I do not read your code now.

But to add quantity steps is a nice idea. The idea of john is also good.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Ramesh0544

Hi all,
         Is there any option to variate the prices based on the quantity and type of the product in the virtue mart 2.0.8 version.

Thanks you.

Rtaxerxes

I would also like something like this, and almost moved to Hikashop because of it. Hika can do it, perhaps if we had a look at their code?

clabis71

but the function is described below in "Drop Down Box Value", as VM2, someone knows you give us any clear answer?

Quote from: Lockerbie on June 03, 2012, 12:25:55 PM



webgobe

Guys and girls, here is the (possible) solution for you!
After struggling myself with this problem, and after I developed some code (and was supported in this financially by Lockerbie and Sander - kudos are going to them!) I developed an easy to use and to maintain solution for this problem.
All you need is to go here: http://www.webgobe.ro/download/category/11-component-hacks.html and download the package, and use the information contained in it.
Here's how works, and how can be used:
In total 5 VirtueMart files are modifyed, only one of them is a core file - the VM language file - the rest are VM template files.
In the download package you will find 3 things: a readme file, a file named en-GB.com_virtuemart.ini WICH CONTAINS ONLY THE LINE TO BE ADDED TO THE ORIGINAL file! (Again, don't just overwrite the original, edit it and add the line in this file to the original) and a package containing the 4 template files modified, arranges in correct folders, so you can simply unpack it and overwrite with them the ones on your server. You can find more details in the readme.
How it works?
All your products are working as prior applying this hack. If you want some of your products to be sold in sixpacks - as Lockerbie wanted - them in the admin interface you need to set the minimum porchase amount for that product to 6.
And that's all! From this very moment this product can be added to the cart (or the amounts in cart can be modifyed) only using multiples of this amount - in our example multiples of 6.
Currently the hack supports quantities up to 14, but can be easily amended to support ANY number.
It's the first release, I will try to make it much more flexible (to support easily ANY number) but is the easiest way to accomplish the goal up to date, I guess.
Like a fine wine... Good from the start and getting better over time.

bladerz

#35
Thank you for this hack, webgobe!
I just implemented it on the new VM 2.0.10 and implemented the change in my template's css file. It works when updating the quantity in the cart - the message "You can buy this product only in multiples of X pieces!!" is displayed. Unfortunately it doesn't seem to do anything in the product details page. I can still add whatever quantity I select there.
Any ideas?

Update: Since I'm not using the default VM template I had to modify the following file - /templates/my_template_name/html/com_virtuemart/productdetails/default.php
In the beginning I added:
if (isset($this->product->min_order_level))
        $step=$this->product->min_order_level;
else
        $step=1;
if($step==0)
        $step=1;


and further in the file changed:
<span class="quantity-controls js-recalculate">
                <input type="button" class="quantity-controls quantity-plus<?php echo $step?>" />
                <input type="button" class="quantity-controls quantity-minus<?php echo $step?>" />
(just to add "<?php echo $step?>" )

Thanks again to webgobe for the hack!

webgobe

Be welcome! - And remember - sharing is caring ;)
Like a fine wine... Good from the start and getting better over time.

goldenprizm

I would like to use your hack....

The current version only supports amounts from 1 to 14.  Some of my order multiples are higher than 14.
Could you assist me on this or lead me in the right direction

webgobe

You need to modify the VM template's .js file (it is in the download package). There are some lines added to support the quantitis up to 14 - one line for each quantity step. You need to add similar lines as you need. That's all.
Like a fine wine... Good from the start and getting better over time.

clabis71

For the developers, but this solution "drop down box value", which was scheduled at version 1.1.9, you can also have it in version 2?
It seems like a trivial thing but it is a very useful function, which many ask


[attachment cleanup by admin]

Lockerbie

Hello Clabis71,

See WebGobe's reply at #34. That's the solution that worked for me! And yep: we've put this in a VM2-setting.
Good luck!

webgobe

An update - I have somewhere an enhanced version, wich has no limitation of 14 max number to be set, and there are less files to modify. I will add that to upload package ASAP.
Like a fine wine... Good from the start and getting better over time.

clabis71

My problem is related to the speech that needs to be set only for some products so easy to use for anyone in the administration side.
In practice there are all products of the same, for some this must be true for others should use the VM in the standard configuration.
If I am confirmed I can do this, then try this solution.

webgobe

This is set up for each products individually.
Like a fine wine... Good from the start and getting better over time.

Milbo

Quote from: webgobe on August 21, 2012, 13:52:44 PM
Guys and girls, here is the (possible) solution for you!
After struggling myself with this problem, and after I developed some code (and was supported in this financially by Lockerbie and Sander - kudos are going to them!) I developed an easy to use and to maintain solution for this problem.
All you need is to go here: http://www.webgobe.ro/download/category/11-component-hacks.html and download the package, and use the information contained in it.
Here's how works, and how can be used:
In total 5 VirtueMart files are modifyed, only one of them is a core file - the VM language file - the rest are VM template files.
In the download package you will find 3 things: a readme file, a file named en-GB.com_virtuemart.ini WICH CONTAINS ONLY THE LINE TO BE ADDED TO THE ORIGINAL file! (Again, don't just overwrite the original, edit it and add the line in this file to the original) and a package containing the 4 template files modified, arranges in correct folders, so you can simply unpack it and overwrite with them the ones on your server. You can find more details in the readme.


Interested to add it to the core?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/