php - Joomla 1.5 with Virtuemart 1.1.9

768

I want add changing on category page, I customize pagewebsitelink.com/components\com_virtuemart\themes\default\templates\browse\browse_3.php

I add code

  <div >
<?php 
$button_lbl = $VM_LANG->_('PHPSHOP_CART_ADD_TO');
$button_cls = 'addtocart_button';
if( CHECK_STOCK == '1' && ( $product_in_stock < 1 ) ) {
  $button_lbl = $VM_LANG->_('VM_CART_NOTIFY');
  $button_cls = 'notify_button';
  $notify = true;
} else {
  $notify = false;
}
?>

<form action="<?php echo $mm_action_url ?>index.php" method="post" name="addtocart" id="addtocart<?php echo $i ?>" <?php if( $this->get_cfg( 'useAjaxCartActions', 1 ) && !$notify ) { echo 'onsubmit="handleAddToCart( this.id );return false;"'; } ?>>

  <input type="submit" value="<?php echo $button_lbl  ?>" title="<?php echo $button_lbl ?>" />
  <input type="hidden" name="category_id" value="<?php echo @$_REQUEST['category_id'] ?>" />
  <input type="hidden" name="product_id" value="<?php echo $product_id ?>" />
  <input type="hidden" name="prod_id[]" value="<?php echo $product_id ?>" />
  <input type="hidden" name="page" value="shop.cart" />
  <input type="hidden" name="func" value="cartadd" />
  <input type="hidden" name="Itemid" value="<?php echo $sess->getShopItemid() ?>" />
  <input type="hidden" name="option" value="com_virtuemart" />
  <input type="hidden" name="set_price[]" value="" />
  <input type="hidden" name="adjust_price[]" value="" />
  <input type="hidden" name="master_product[]" value="" />
</form>
</div>

After adding this line add to cart button appear on list items, but than i click on add to cart button error will come

Please enter a valid quatity for this item

How i can solve this?

109

Answer

Solution:

You need to specify a quantity as an input field, hidden or otherwise. We only wanted the customer to be able to order one of an item, so added this code:

<input type="hidden" value="1" name="quantity">

Having that named input field satisifed the Virtuemart validation.

People are also looking for solutions to the problem: php - Pass an object only if Auth is available in Laravel

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.