Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • Carlo B. Dalle Molle Friend
    #185721

    Hi,
    how I can to insert the add to cart button in the category layout view, in the featured product and best sales?
    thanks
    Regards

    Carlo B. Dalle Molle Friend
    #486193

    Hi,
    thank you for your support.
    1. in the featured product and best sales –> dont’ work.
    2. In the category view –> work correctly

    I’ve another question for you…how I can to use the vintas cart style for the add to cart button?


    1. Vintas
    phong nam Friend
    #486312

    Hi templaeit,

    I’m sorry for making this issue more complex. It’s easer than I thought. So, I’d like to rewrite the guide for you to add “Add to cart” button as you attached.

    1. Add to cart button in the featured product and best sales.
    You just need to access this VirtueMart Products modules in vm-product position (like our demo) which are Featured Products & Best Sales, and Set Yes to “Show Add-To-Cart Link?”. You can see my attached image for results.

    2. In the category view. (You need a little bit customization.)
    On your server, open templatesja_vintashtmlcom_virtuemartcategory default.php. Then paste below codes:

    [PHP] <form method=”post” class=”product” action=”index.php” id=”addtocartproduct<?php echo $product->virtuemart_product_id ?>”>
    <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>[/PHP]

    AFTER codes:

    [PHP]<p>
    <?php // Product Details Button
    echo JHTML::link($product->link, JText::_(‘COM_VIRTUEMART_PRODUCT_DETAILS’), array(‘title’ => $product->product_name,’class’ => ‘product-details’));
    ?>
    </p>[/PHP]

    Then Save. Clean T3 Cache. Lets see my attached image with Add to cart button on Category view

    Don’t forget to inform me your result.

    Regards,

    Leo

    amoreno Friend
    #487915

    Hi,

    I am trying to use it but i do not understand where to place the code.
    In fact i only want the button in the category view, so i deduce that only step 2 is needed !

    1.- on the templatesja_vintashtmlcom_virtuemartcategorydefault.php file there is already code, so where exactly i paste the first part of the code.

    2.- Where exactly i paste the “AFTER codes”??

    thanks in advance,
    Albert

    phong nam Friend
    #487940

    Hi amoreno,

    🙂 In step 2. <blockquote>on the templatesja_vintashtmlcom_virtuemartcategory default.php </blockquote>
    Firstly, You need to find where is <blockquote> <p>
    <?php // Product Details Button
    echo JHTML::link($product->link, JText::_(‘COM_VIRTUEMART_PRODUCT_DETAILS’), array(‘title’ => $product->product_name,’class’ => ‘product-details’));
    ?>
    </p></blockquote> >> at line 298.
    Then you copy & paste the above codes after this code.

    >> Then Save.

    Regards,

    Leo

    Carlo B. Dalle Molle Friend
    #487965

    Hi,
    now it work fine, thank you for your support.

Viewing 6 posts - 1 through 6 (of 6 total)

This topic contains 6 replies, has 3 voices, and was last updated by  Carlo B. Dalle Molle 11 years, 6 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum