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

Template Overrides

Started by mac13, October 18, 2013, 11:20:31 AM

Previous topic - Next topic

mac13

Hello,

I'm working on a virtuemart store in my localhost with joomla 2.5.11 and Virtuemart 2.0.22.

I've modified an artisteer template (new modules, css style...), but i have a problem when i try show "add to cart" button on index store (Top ten, featured Products...) I've done a template override with "default_products.php" file adding the next code:

<form method="post" class="product" action="index.php" id="addtocartproduct<?php echo $product->virtuemart_product_id ?>">

<?php // Product custom_fields
 
if (!empty($this->product->customfieldsCart)) { ?>

<div class="product-fields">
<?php foreach ($this->product->customfieldsCart as $field)
 { 
?>
<div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
<span class="product-fields-title" ><b><?php echo JText::_($field->custom_title?></b></span>
<?php echo JHTML::tooltip($field->custom_tipJText::_($field->custom_title), 'tooltip.png'); ?>
<span class="product-field-display"><?php echo $field->display ?></span>


<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($this->product->customsChilds)) { ?>


<div class="product-fields">
<?php foreach ($this->product->customsChilds as $field) { ?>
<div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field->field_type ?>">
<span class="product-fields-title" ><b><?php echo JText::_($field->field->custom_title?></b></span>
<span class="product-field-desc"><?php echo JText::_($field->field->custom_value?></span>
<span class="product-field-display"><?php echo $field->display ?></span>


</div><br/ >

<?php
 
?>

</div>
<?php ?>


<div class="addtocart-bar">


<?php // Display the quantity box ?>

<!-- <label for="quantity<?php echo $this->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" name="quantity[]" value="1" />
</span>
<span class="quantity-controls">
<input type="button" class="quantity-controls quantity-plus" />
<input type="button" class="quantity-controls quantity-minus" />
</span>
<?php // Display the quantity box END ?>


<?php // Add the button

 
$button_lbl JText::_('COM_VIRTUEMART_CART_ADD_TO');
 
$button_cls ''//$button_cls = 'addtocart_button';
 
if (VmConfig::get('check_stock') == '1' && !$this->product->product_in_stock) {
 
$button_lbl JText::_('COM_VIRTUEMART_CART_NOTIFY');
 
$button_cls 'notify-button';
 } 
?>



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

<span class="addtocart-button">
<input type="submit" name="addtocart" class="addtocart-button" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
</span>


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

</div>


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

<input type="hidden" class="pname" value="<?php echo $product->product_name ?>">
<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 ?>" />
<?php /** @todo Handle the manufacturer view */ ?>
<input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
</form>


The "add to cart" button appears but the amount ítem doesn't Works and when i click on "add to cart" button, the cart  open without any ítem inside.

I've tried the same wih the "default.php" file on "components/com_virtuemart/views/category/tmp/" and the button doesn't appears.

Any idea?

Thanxs in advance

jenkinhill

Artisteer generated templates cause all sorts of problems for Joomla/VirtueMart users as the code and css generated is non-standard. From your description it sounds like a JavaScript conflict, probably the template is loading its own jQuery library or the Artisteer menu code is conflicting.

See http://forum.virtuemart.net/index.php?topic=119638.0
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

mac13

thank you  jenkinhill.

I think there is another issue. When i do the same with the virtuemart category (Override "components/com_virtuemart/views/category/tmp/default.php" the "add tocart" option appears in the category section and works fine... the product is added to the shopping cart correctly.

Maybe the problem is only in the index store page (Featured Products, Topten...)

X file  :o

Thanks again

jenkinhill

OK then maybe you should update to the current secure Joomla & VM versions. 2.0.22 was buggy but I don't know if your problem was present then - it is a few versions ago,
Current secure versions are J2.5.14 and VM2.0.24 with a minor updated version due in a few days.

See the note in the security update announcement about updating template overrides (if you use them):  http://virtuemart.net/news/latest-news/446-important-security-release-vm-team-at-joomladay-germany
And see http://forum.virtuemart.net/index.php?topic=118683

Updates should always be tested on a backup copy of a live site.
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

mac13

Ok, i've upgrade Joomla versión to 2.5.14 and Virtuemart to 2.0.24.

The "add to cart" button still don't work properly. I don't know where is the problem, all the overrides works fine except this one. I give up.

I've created a new product module with "Best selling" and it works fine, so i leave it like this. I've created my own Virtuemart home page with other product modules (Featured, latest...)

Thank you very much for your help.