VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: lbmessick on August 19, 2012, 00:30:28 AM

Title: Do not want quantity updates in cart
Post by: lbmessick on August 19, 2012, 00:30:28 AM
How can I hide/remove the quantity update/change option in cart?  I have made the changes from "textinput" and "submit" to hidden but must be wrong file.  I do not want the user to be able to change quantity.  Thanks!

Joomla 2.5
VM 2.0.8
Title: Re: Do not want quantity updates in cart
Post by: bytelord on August 19, 2012, 11:10:10 AM
Hello,

in your custom template, inside the file html/com_virtuemart/cart/default_pricelist.php around line 153 there the line you seach for:

<input type="text" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" class="inputbox" size="3" maxlength="4" name="quantity" value="<?php echo $prow->quantity ?>" />

You could change the input type property from text to hidden:

<input type="hidden" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" class="inputbox" size="3" maxlength="4" name="quantity" value="<?php echo $prow->quantity ?>" />

so the quantity box is not showing.

Update: You could use the attribute disabled="disabled" instead of changing the field to hidden ... so the user can see the quantity.


If you also want to hide the refresh or remove icon you could just hide them using css or add some css inside your php file (same file as above)

around line 157

<input type="submit" class="vmicon vm2-add_quantity_cart" name="update" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" align="middle" value=" "/>


add a style attribute, like style="display:none". that line will become

<input type="submit" class="vmicon vm2-add_quantity_cart" name="update" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" align="middle" value=" " style="display:none"/>


Hope it helps you.

Regards,

Bytelord.
Title: Re: Do not want quantity updates in cart
Post by: John2400 on August 19, 2012, 12:31:39 PM
bytelord,

how about stopping the plus and minus in the actual product - How can you do that ?

So the item is always  "1"  no multiple products
Title: Re: Do not want quantity updates in cart
Post by: bytelord on August 19, 2012, 13:09:08 PM
Hi John,

if you asking how to stop it inside product details page i can think various ways.
An easy one is to hide the plus/minus icons through css (span.quantity-control{display:none} and as for the quantity box you can easily disable it.

around line 74 inside productdetails\default_addtocart.php

<input type="text" class="quantity-input js-recalculate" name="quantity[]" value="<?php if (isset($this->product->min_order_level) && (int) $this->product->min_order_level 0) {


changes to:

<input type="text" disabled="disabled" class="quantity-input js-recalculate" name="quantity[]" value="<?php if (isset($this->product->min_order_level) && (int) $this->product->min_order_level 0) {


we add the attribute disabled="disabled". the same thing can be done inside cart page that before we just hide it ... so the user will be able to see the quantity.

At the end  the user cannot change the quantity by "hand" and after we hide the arrows then the only quantity will the min_order_level or "1".

BUT: he can just press twice or more the button addtocart :)
In that case i think needs javascript to "block" adding in cart same product more than once...

Regards
Title: Re: Do not want quantity updates in cart
Post by: lbmessick on August 20, 2012, 03:59:42 AM
SOLVED!!

Thanks to bytelord!! His solution works.  I happen to be using component Pre-Order so I had to change it there also.  STUPID ME!

BTW bytelord, I cannot get the attribute "disabled" to work.  I must be putting it in the wrong line of code or the wrong place in the line.

Again, many, many thanks to John2400 and bytelord for there help.  Sorry guys, but now I know where to go.

Brett
Title: Re: Do not want quantity updates in cart
Post by: bytelord on August 20, 2012, 05:30:14 AM
Hello,

You are welcome.

to disable the quantity field inside cart/default_pricelist arrount line 153 change the line to:

<input type="text" disabled="disabled" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" class="inputbox" size="3" maxlength="4" name="quantity" value="<?php echo $prow->quantity ?>" />


Title: Re: Do not want quantity updates in cart
Post by: lbmessick on August 20, 2012, 05:49:52 AM
John,
Tell me when you have had enough......

1    Dumb question but do you type the ?  I tried it just 'disabled = "disabled" with no result.

2    Do you know which language file to look to to change Quantity / Update header.  Think I have looked through them all but obviously not.

Thanks again for all the help!
Title: Re: Do not want quantity updates in cart
Post by: bytelord on August 20, 2012, 05:54:40 AM
fixit! :)
Title: Re: Do not want quantity updates in cart
Post by: bytelord on August 20, 2012, 05:59:46 AM
For change the language files i suggest you ti use joomla language override.

take a look here: http://forum.virtuemart.net/index.php?topic=106497.msg355752#msg355752
Title: Re: Do not want quantity updates in cart
Post by: lbmessick on August 20, 2012, 06:18:31 AM
Bytelord,
You are a VM GOD!!!!!  Worked like a charm.
When I make my millions, let me know if you want a job.   LOL

Brett
Title: Re: Do not want quantity updates in cart
Post by: MartinSchmied on September 16, 2012, 17:16:16 PM
hi,

I have a problem which is related to this topic! Maybe you have an answer for me:

I want to limit the possible amount of products which can be added to the shopping cart! In my research I only found the possibility to set a maximum amount of a product or of products of one categorie. Is is possible to limit the generel amount of products in the shopping cart? Would be necessary for my Online-Shop!

friendly greedings,
martin
Title: Re: Do not want quantity updates in cart
Post by: raunhar on November 05, 2012, 09:29:15 AM
Will this work fr joomla 1.5.26 with VM 2.0.12f

I do not need the qnty button.
Title: Re: Do not want quantity updates in cart
Post by: bytelord on November 05, 2012, 18:02:31 PM
Hello,

I don't use joomla 1.5

You could use some CSS to hide the quantity button:

.input.quantity-input {
display:none;
}

Regards
Title: Re: Do not want quantity updates in cart
Post by: raunhar on November 06, 2012, 06:37:17 AM
Thanks, it worked.
Title: Re: Do not want quantity updates in cart
Post by: raunhar on November 23, 2012, 08:31:16 AM
Where can I find the language folder in the new version.

Please help
Title: Re: Do not want quantity updates in cart
Post by: bytelord on November 23, 2012, 14:37:05 PM
@raunhar

What do you mean? Which version?

Regards
Title: Re: Do not want quantity updates in cart
Post by: marco.azzali.76 on June 26, 2014, 15:26:26 PM
Hi, it looks like this file default_pricelist.php is ignored completely in my site; no effects if I modify it in its original location, neither if I put it modified in the template.
I'm using one-page-checkout plugin, does this file apply anyway ?

Marco

Virtuemart 2.6.6
Joomla 2.5.22
PHP 5.2.28