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?
The cart is a form. You cannot put a form (which a product module is) within another form, they both cannot work.
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>
</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>