News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Custom add to cart button not triggering Modal popup VM 2.0.24

Started by jacquesg, October 16, 2013, 12:01:45 PM

Previous topic - Next topic

jacquesg

Hi all

Joomla 2.5.4 and VM 2.0.24.
Template:  Virtuemarttemplates.net Echo

Situation:
I altered the override for default_products in the "Virtuemart" view in the template html override folder.
I am changing the view to a grid view, and I would like to have an add to cart link next to each product.  I added the following code:
====

<?php
if (isset($product->step_order_level))
$step=$product->step_order_level;
else
$step=1;
if(
$step==0)
$step=1;
$alert=JText::sprintf ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED'$step);

?>


<div class="addtocart-area">

<form method="post" class="product js-recalculate" action="<?php echo JRoute::('index.php'); ?>">
<input name="quantity" type="hidden" value="<?php echo $step ?>" />
<?php // Product custom_fields
if (!empty($product->customfieldsCart)) {
?>

<div class="product-fields">
<?php foreach ($product->customfieldsCart as $field) { ?>
<div class="product-field product-field-type-<?php echo $field->field_type ?> row-fluid">
<div class="span5">
<?php if ($field->show_title) { ?>
<span class="product-fields-title-wrapper"><span class="product-fields-title"><strong><?php echo JText::($field->custom_title?></strong></span>
<?php }
if ($field->custom_tip) {
echo JHTML::tooltip ($field->custom_tipJText::($field->custom_title), 'tooltip.png');
?>
</span>
</div>
<div class="span7">
<span class="product-field-display"><?php echo $field->display ?></span>
</div>
<span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
</div><br/>
<?php
}
?>

</div>
<?php
}
/* Product custom Childs
 * to display a simple link use $field->virtuemart_product_id as link to child product_id
 * custom_value is relation value to child
 */

if (!empty($product->customsChilds)) {
?>

<div class="product-fields">
<?php foreach ($product->customsChilds as $field) { ?>
<div class="product-field product-field-type-<?php echo $field->field->field_type ?> row-fluid">
<div class="span5">
<span class="product-fields-title"><strong><?php echo JText::($field->field->custom_title?></strong></span>
</div>
<div class="span7">
<span class="product-field-desc"><?php echo JText::($field->field->custom_value?></span>
</div>
<span class="product-field-display"><?php echo $field->display ?></span>

</div><br/>
<?php ?>
</div>
<?php ?>

<div class="addtocart-bar">

<script type="text/javascript">
function check(obj) {
// use the modulus operator '%' to see if there is a remainder
remainder=obj.value % <?php echo $step?>;
quantity=obj.value;
if (remainder  != 0) {
alert('<?php echo $alert?>!');
obj.value = quantity-remainder;
return false;
}
return true;
}
</script>

<?php // Display the quantity box

$stockhandle VmConfig::get ('stockhandle''none');
if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($product->product_in_stock $product->product_ordered) < 1) {
?>

<a href="<?php echo JRoute::('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' $product->virtuemart_product_id); ?>" class="notify"><?php echo JText::('COM_VIRTUEMART_CART_NOTIFY'?></a>

<?php } else { ?>
<!-- <label for="quantity<?php echo $product->virtuemart_product_id?>" class="quantity_box"><?php echo JText::('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
<span class="quantity-box">
<input type="text" class="quantity-input js-recalculate" name="quantity[]" value="<?php if (isset($product->min_order_level) && (int)$product->min_order_level 0) {
echo $product->step_order_level;
} else if(!empty($product->min_order_level)){
echo $product->min_order_level;
}else {
echo '1';
?>
"/>
    </span>
<span class="quantity-controls js-recalculate">
<input type="button" class="quantity-controls quantity-plus" value="+"/><input type="button" class="quantity-controls quantity-minus" value="-"/>
    </span>
<?php // Display the quantity box END ?>

<?php
// Display the add to cart button
?>

<span class="addtocart-button">
<?php echo shopFunctionsF::getAddToCartButton ($product->orderable); ?>
</span>
<?php ?>

<div class="clear"></div>
</div>

<?php // Display the add to cart button END  ?>
<input type="hidden" class="pname" value="<?php echo htmlentities($product->product_nameENT_QUOTES'utf-8'?>"/>
<input type="hidden" name="option" value="com_virtuemart"/>
<input type="hidden" name="view" value="cart"/>
<noscript><input type="hidden" name="task" value="add"/></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>"/>
</form>

<div class="clear"></div>
</div>


THE PROBLEM:

It seems that I am missing some code to make the Modal popup work on this screen.  On all other screens the modal popup works fine.  On this page alone, it redirects me to the cart instead of popping up the modal.  I am also using Shape5 Ajax Column cart, so I do not want a page refresh or a post to the cart page.

What am I missing?

Thanks

Jacques

loai90

any new updates for this i am having the same issue

on the home page featured products, the  vmprices.js file is not being loaded as i think