all edits from highlite topichttp://forum.virtuemart.net/index.php?topic=90961.0
i figured out of myself for VM 2.0.0. After upgrading to VM 2.0.2 and fixing product template override, is there big problem with add to cart button in category view!
I have exactly the same problem as users last post in highlite topic.
Strange thing is, that after click to add to cart button is modal window two times generated - first with name of product and shop backlink, second with text "was added to cart" and show cart link.
Cart is empty.
Any ideas?
EDIT:
Add to cart button in detail product view works fine without problem.
It looks like JS problem and i alco try to combine setting with Google JQuery library loading and WM Jquery loading. Doesnt help.
I was also wondering, if it is a problem with old problem, since from 2.0.3 has change layout structure and there is more template, even all old functions should be deprecated, but available. I load standard template from 2.0.3 and edit it accorading the highlight topic and doesnt work too.
EDIT:
after delete this parts of code from category template, it looks like, add to cart button started works. but i need more conclusive testing.
$js = "
jQuery(document).ready(function () {
jQuery('.orderlistcontainer').hover(
function() { jQuery(this).find('.orderlist').stop().show()},
function() { jQuery(this).find('.orderlist').stop().hide()}
)
});
";
$document->addScriptDeclaration($js);
if ($this->search) { ?>
<!--BEGIN Search Box -->
<form action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&search=true&limitstart=0&virtuemart_category_id='.$this->category->virtuemart_category_id ); ?>" method="post">
<div class="virtuemart_search">
<?php
$option = array('virtuemart_custom_id' =>null, 'custom_title' => JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'));
$options = array_merge(array($option), $this->searchcustom->selectList);
echo JText::_('COM_VIRTUEMART_SET_PRODUCT_TYPE').' '.JHTML::_('select.genericlist', $options, 'custom_parent_id', 'class="inputbox"', 'virtuemart_custom_id', 'custom_title', $this->searchcustom->custom_parent_id); ?>
<br />
<?php if ($this->searchcustom->custom_parent_id) {
foreach ($this->searchcustom->selected as $key =>$custom){
$option = array('custom_value' =>null, 'title' => JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'));
$options = array_merge(array($option), $custom->fields[$custom->virtuemart_custom_id]);
echo JText::_('COM_VIRTUEMART_SET_PRODUCT_TYPE').' '.JHTML::_('select.genericlist', $options, 'customfields['.$custom->virtuemart_custom_id.']', 'class="inputbox"', 'custom_value', 'title', 0);
}
} ?>
<input style="height:16px;vertical-align :middle;" name="keyword" class="inputbox" type="text" size="20" value="<?php echo $this->keyword ?>" />
<input type="submit" value="<?php echo JText::_('COM_VIRTUEMART_SEARCH') ?>" class="button" onclick="this.form.keyword.focus();"/>
</div>
<input type="hidden" name="search" value="true" />
<input type="hidden" name="category" value="0" />
<input type="hidden" name="view" value="category" />
</form>
<!-- End Search Box -->
<?php } ?>
and need to close PHP code, because end tag we deelte in last part of code. From this:
$document = JFactory::getDocument();
to this
$document = JFactory::getDocument(); ?>
Hello,
I have done these changes (edit2, ie, delete the parts of the code).
From the category page the 'add to cart' button works for me, but if in this page I use the search button, in the result, the 'add to cart button' does NOT work...
I hope this can help
Hello,
If you change in he file: \components\com_virtuemart\assets\js\vmprices.js
the line addtocart = cart.find('input.addtocart-button'),
to addtocart = cart.find('input.addtocart-button').unbind("click"),
only one box is opened and the 'add to cart' button works!
And all the changes related to the top of this post (jQuery(document).ready(function ()...) are not necessary.
Thanks