load virtuemart products module in cart , "add to cart" button can not work

Started by martinlaipe, October 22, 2020, 13:42:07 PM

Previous topic - Next topic

martinlaipe

PHP version : 7.3.8
Joomla version : 3.9.22
Virtuemart version : 3.4.2

I would like to make season promotion.  If customer buy over $300 ,  show special products inside cart (position between customer detail and pricetable) and attract customer to buy
- I create the Virtuemart Products module with custom position name.
- I tried to code {loadposition custom_name} in templates\template_name\html\com_virtuemart\cart\default_pricelist.php    However, the module cannot show correct.
- I tried to use module anywhere {module id_no} , module show but "add to cart" cannot function.
- I tried to set the module as standard position provided by template, module show and "add to cart" work correct.  However, I hope to make the module inside the cart.

Can anyone help?

jenkinhill

The cart is a form. You cannot put a form (which a product module is) within another form, they both cannot work.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

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

GJC Web Design

you can add to cart by simple urls

/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=6&virtuemart_category_id=8&quantity[]=1

or I have e.g. had "Add Giftwrapping" by using a sub template in the cart and resubmit the cart with a different task

<span class="giftarea">
<?php echo JText::_('VMSHIPMENT_RULES_GIFT_LABEL'); ?>
<script type="text/javascript">
jQuery(document).ready(function($) {   
      $('#giftty').click(function() {       
          $('[name="task"]').val('add');
       });
});
</script>
<input type="hidden"  name="quantity[<?php echo $giftid?>]"  value="1"/>
<span class="giftbut-right" style="float:right;">
<button type="submit" id="giftty" class="vm-button-correct" name="add"><?php echo JText::_('VMSHIPMENT_RULES_GIFT_BUTTON'); ?></button>  &nbsp;
</span>
<input type="hidden" name="virtuemart_product_id[<?php echo $giftid?>]" value="<?php echo $giftid?>"/>
<input type="hidden" class="pname" value="<?php echo JText::_('VMSHIPMENT_RULES_GIFT_LABEL'); ?>"/>
<?php
$itemId=vRequest::getInt('Itemid',false);
if($itemId){
echo '<input type="hidden" name="Itemid" value="'.$itemId.'"/>';
?>


</span>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation