Author Topic: Remove Quantity box on browse page problem  (Read 33801 times)

Maccadon

  • Beginner
  • *
  • Posts: 18
Remove Quantity box on browse page problem
« on: August 07, 2008, 08:51:32 am »
I want to remove the quantity box on my browse page
I found a way to remove it in
Code: [Select]
/Components/com_virtuemart/themes/default/templates/browse/includes/addtocart_form.tpl.phpBut after i removed the line 16
Code: [Select]
<?php echo $ps_product_attribute->show_quantity_box($product_id,$product_id); ?><br />i get this error when i try to place something in the basket
Code: [Select]
Info: To add this product into your cart you have to select a product variant on the details page.
I searched for different solutions but none of the worked
I've searched the manual and the forums but i only see a option to hide the basket in the product details (flypage).

Is there a way to get this to work?

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27426
  • Always on vacation
    • Jenkin Hill Internet
Re: Remove Quantity box on browse page problem
« Reply #1 on: August 10, 2008, 11:42:54 am »
There is a way way to do this, which will also remove add to cart. Edit the browse template you are using for your category.

These are the ones in /components/com_virtuemart/themes/default/templates/browse/

Remove the code <?php echo $form_addtocart ?> and tidy up any spans or other code to give a neat layout.
 
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.4.3.10057 on Joomla 3.9.8 PHP 7.0.33
Testing VM .3.6.0.10075 on Joomla 3.9.8

korb

  • Quality&Testing Team
  • Full Member
  • *
  • Posts: 685
  • VM 2.0 in heavy testing
    • Buy my work
Re: Remove Quantity box on browse page problem
« Reply #2 on: September 14, 2008, 16:47:00 pm »
Update: I tried this with sh404SEF on and is not working. If I delete the code, add to cart dissapear, If I comment <!-- code  --> add to cart (ajax on) is not working.

I want to try this out, but anyone tried it yet?

mkst

  • Beginner
  • *
  • Posts: 6
Re: Remove Quantity box on browse page problem
« Reply #3 on: October 29, 2008, 14:04:03 pm »
To remove the quanity input box and the up/down arrows. remove the line:
Quote
echo $ps_product_attribute->show_quantity_box($product_id,$product_id);

and add this after

Quote
<input type="hidden" class="inputboxquantity" size="4" id="quantity24" name="quantity[]" value="1" />

cricket

  • Beginner
  • *
  • Posts: 15
Re: Remove Quantity box on browse page problem
« Reply #4 on: November 04, 2008, 03:33:11 am »
To remove the quanity input box and the up/down arrows. remove the line:
Quote
echo $ps_product_attribute->show_quantity_box($product_id,$product_id);

Hi, can ask where this code is? I've looked on all the browse page templates and I don't see this line of code? Thanks.

cricket

  • Beginner
  • *
  • Posts: 15
Re: Remove Quantity box on browse page problem
« Reply #5 on: November 06, 2008, 03:15:48 am »
bump

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27426
  • Always on vacation
    • Jenkin Hill Internet
Re: Remove Quantity box on browse page problem
« Reply #6 on: November 06, 2008, 11:07:44 am »
Use Agent Ransack to locate code.

show_quantity_box is used in /components/com_virtuemart/themes/default/templates/product_details/includes/addtocart_form.tpl.php
and /components/com_virtuemart/themes/default/templates/browse/includes/addtocart_form.tpl.php
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.4.3.10057 on Joomla 3.9.8 PHP 7.0.33
Testing VM .3.6.0.10075 on Joomla 3.9.8

scubasapiens

  • Beginner
  • *
  • Posts: 22
Re: Remove Quantity box on browse page problem
« Reply #7 on: December 10, 2008, 12:32:32 pm »
That is brilliant - thanks, that really made my day - and my website look a lot better :-)

Thanks also for the tip about Agent Ransack; good tool.

/Chris

radagast

  • Beginner
  • *
  • Posts: 12
Re: Remove Quantity box on browse page problem
« Reply #8 on: April 06, 2009, 15:15:00 pm »
Another way to do the same thing:
in the file which actually displays the quantity box, you can choose what page or other condition has to be met.

/components/com_virtuemart/themes/default/templates/product_details/includes/quantity_box_general.tpl.php
of course, you would copy the default folder to your own theme name and select that in the VC admin so that you can always fall back on the default theme if you have to

around line 7 (i'm including the line either side of my additions)
Code: [Select]
extract( $quantity_options );
// add this test to only show the quantity selector on the details page
if($page != shop.product_details) {
$display_type = "hide";
}

$html = '';

Sid.

  • Beginner
  • *
  • Posts: 42
    • SidFilmz
Hide Qty Box on Details/Browse - How Default to Hide from Admin?
« Reply #9 on: April 28, 2009, 03:23:45 am »
For the Product Details page I changed /components/com_virtuemart/themes/default/templates/product_details/includes/quantity_box_general.tpl.php around lines 9 and 45 respectively from this:

Code: [Select]
$html = '';
if(!$child && $display_type != 'hide') {
$html = '<label for="quantity'.$prod_id.'" class="quantity_box">'.$VM_LANG->_('PHPSHOP_CART_QUANTITY').':&nbsp;</label>';
}

and

Code: [Select]
case "none" :
default:
$html .= '<input type="text" class="inputboxquantity" size="4" id="quantity'.$prod_id.'" name="quantity[]" value="'.$quantity.'" />
<input type="button" class="quantity_box_button quantity_box_button_up" onclick="var qty_el = document.getElementById(\'quantity'.$prod_id.'\'); var qty = qty_el.value; if( !isNaN( qty )) qty_el.value++;return false;" />
<input type="button" class="quantity_box_button quantity_box_button_down" onclick="var qty_el = document.getElementById(\'quantity'.$prod_id.'\'); var qty = qty_el.value; if( !isNaN( qty ) && qty > 0 ) qty_el.value--;return false;" />
';
break;
}

Updated to the following in order to remove the "Quanity" Label and hide the Quantity Box:

Code: [Select]
$html = '';
if(!$child && $display_type != 'hide') {
$html = '';
}

and

Code: [Select]
case "none" :
default:
$html .= '<input type="hidden" id="quantity'.$prod_id.'" name="quantity[]" value="1" />';
break;
}


And this accomplishes a fix for the front-end, where I don't want customers to have the option of additional quantities, but this does not solve my problem in that from the Admin side, when entering New Products, the Display Options are defaulted to show the Quantity Box.

I would like all New Products to have their Display Options default to "Hide Quantity Box" so that the above workaround isn't necessary.  Does anyone know where the file is that would allow us to change the default of all new products to Hide the Quantity Box?

Mizpah

  • Beginner
  • *
  • Posts: 29
Re: Remove Quantity box on browse page problem
« Reply #10 on: May 21, 2009, 12:07:47 pm »
Heya Guys;

I am trying to remove the quantity selector on the browse page only - and to keep it on the flypages.  I have this behavior by default in most places, due to attributes on most products, however where there are not atributes, the quantity box shows up!

I have tested adding this code (from this thread):

Code: [Select]
extract( $quantity_options );
// add this test to only show the quantity selector on the details page
if($page != shop.product_details) {
$display_type = "hide";
}

Which seems to say, if not on 'shop.product.details' then hide the quantity box.

However after making the change, it appears to be always hidden!

Thus it seems that:

http://jobeky.myzen.co.uk/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=19&category_id=7&option=com_virtuemart&Itemid=51

Is NOT meeting the condition - where it looks as if it should be ?  I would love it if someone could point me in the right direction here, heres the whole of my quantity_box_general.tpl.php page for reference.

Code: [Select]
<?php if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); 
mm_showMyFileName(__FILE__);
/** This template is used for the quantity box arrangement of products, within the add-to-cart form */ 

extract$quantity_options );
// add this test to only show the quantity selector on the details page
if($page != shop.product_details) {
$display_type "hide";
}

$html '';
if(!
$child && $display_type != 'hide') {
$html '<label for="quantity'.$prod_id.'" class="quantity_box">'.$VM_LANG->_('PHPSHOP_CART_QUANTITY').':&nbsp;</label>';
}

switch(
$display_type) {
case "radio" //Radio Box
$html .= '<input type="hidden" id="quantity'.$prod_id.'" name="quantity[]" value="'.$quantity.'" />';
$html .= '<input type="radio" class="quantitycheckbox" id="selItem'.$prod_id.'" name="selItem" value="0" ';
if ($quantity ) {
$html .= 'checked="checked" ';
}
$html .= 'onclick="alterQuantity(this.form)" />';
break;
case "hide" // Hide box - but set quantity to 1!
$html .= '<input type="hidden" id="quantity'.$prod_id.'" name="quantity[]" value="1" />';
break;
case "check" :
$html .= '<input type="hidden" id="quantity'.$prod_id.'" name="quantity[]" value="'.$quantity.'" style="vertical-align: middle;"/>
<input type="checkbox" class="quantitycheckbox" id="selItem'
.$prod_id.'" name="check[]" ';
if ($quantity ) {
$html .= 'checked="checked"';
}
$html .= ' value="1" onclick="javascript: if(this.checked==true) document.getElementById(\'quantity'.$prod_id.'\').value = 1; else {document.getElementById(\'quantity'.$prod_id.'\').value=0;} "/> ';
break;
case "drop" :
$code '<select class="inputboxquantity" id="quantity'.$prod_id.'" name="quantity[]">';
for($i=$quantity_start;$i<$quantity_end+1;$i += $quantity_step) {
$code .= '  <option value="'.$i.'"';
if ($i == $quantity) {
$code .= ' selected="selected"';
}
$code .= '>'.$i."</option>\n";
}
$code .= "</select>\n";
$html .= $code;
break;
case "none" :
default:
$html .= "
<input type='text' id='quantity
$prod_id' name='quantity[]' class='inputboxquantity' size='4' name='quantity_adjust' value='1' />
<div class='quantity_box_button quantity_box_button_up'><span>+</span></div>
<div class='quantity_box_button quantity_box_button_down'><span>-</span></div>
"
;

break;
}
echo 
$html;
?>


Thanks in advance!

duderek

  • Beginner
  • *
  • Posts: 27
Re: Remove Quantity box on browse page problem
« Reply #11 on: August 25, 2009, 00:55:31 am »

Code: [Select]
$html = '';
if(!$child && $display_type != 'hide') {
$html = '<label for="quantity'.$prod_id.'" class="quantity_box">'.$VM_LANG->_('PHPSHOP_CART_QUANTITY').':&nbsp;</label>';
}

and

Code: [Select]
case "none" :
default:
$html .= '<input type="text" class="inputboxquantity" size="4" id="quantity'.$prod_id.'" name="quantity[]" value="'.$quantity.'" />
<input type="button" class="quantity_box_button quantity_box_button_up" onclick="var qty_el = document.getElementById(\'quantity'.$prod_id.'\'); var qty = qty_el.value; if( !isNaN( qty )) qty_el.value++;return false;" />
<input type="button" class="quantity_box_button quantity_box_button_down" onclick="var qty_el = document.getElementById(\'quantity'.$prod_id.'\'); var qty = qty_el.value; if( !isNaN( qty ) && qty > 0 ) qty_el.value--;return false;" />
';
break;
}

Updated to the following in order to remove the "Quanity" Label and hide the Quantity Box:

Code: [Select]
$html = '';
if(!$child && $display_type != 'hide') {
$html = '';
}

and

Code: [Select]
case "none" :
default:
$html .= '<input type="hidden" id="quantity'.$prod_id.'" name="quantity[]" value="1" />';
break;
}


I tried all that and still having the quantity box show up.  does that only work on the the older versions pre-1.1.3 stable or something?

udaydahale

  • Beginner
  • *
  • Posts: 4
Re: Remove Quantity box on browse page problem
« Reply #12 on: January 04, 2010, 14:31:01 pm »
i use virtumart 1.1.4
can i display attribute list as option button format?

regards,
Uday

sorry for english

cherubini

  • Beginner
  • *
  • Posts: 5
Re: Remove Quantity box on browse page problem
« Reply #13 on: February 09, 2010, 23:34:52 pm »
I have a site that is selling subscriptions to videos.  Therefore the quantity is always one.  How can I remove the quantity box on the "Show Cart" page?  As well as removing the "update quantity" arrows?

Thanks.

VM Version 1.1.4 Stable
J! 1.5.15

gocartgo

  • Beginner
  • *
  • Posts: 28
Re: Remove Quantity box on browse page problem
« Reply #14 on: May 28, 2010, 16:19:35 pm »
I am also interested in...

How can I remove the quantity box on the "Show Cart" page?  As well as removing the "update quantity" arrows?

Thanks