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

add to cart in category view

Started by alyssaanne1, September 25, 2013, 13:59:01 PM

Previous topic - Next topic

alyssaanne1

Hi,

So I have the add to cart button in the category view... (not sure how) But the problem i have is that the "add to cart" button is allowing people to check out without selecting variables that are in the child products.

For example, the add to cart in category view is allowing people to add a tshirt to the cart without selecting the size and color.....

How do i fix this?
Thanks
alyssa


This code is in my templates/com_virtuemart/default.php   settings....

// 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';
                        } ?>

I am thinking here is where i need to add code to check for child products and variations.... Help please!!! 

I need to make sure that when, for example, someone adds a tshirt to the cart it asks for size and color. which i added via child products.


the url is www.roguegunfighter.com  it is a live site and i really need to get this fixed up!!  THanks so much in advance for the help!

Maxim Pishnyak

That sticked thread about addtocart-in-category couldn't help you?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

alyssaanne1

I read many threads and responses on the add to cart.  But am unable to fix it. 

I would greatly appreciate the helo on how to ensure child products are pulled for the add to cart in category view.

thank you very much!
Alyssa

AH

This is working if you have done what madking's solution suggested, not if you have used files from somewher in the thread!

These are the steps:

1 Create a folder rootOfYourSite/templates/yourTemplate/html/com_virtuemart/category

Copy into this:-

2 default.php from com_virtuemart/views/category/tmpl
3 default_addtocart.php from components/com/virtuemart/views/productdetails/tmpl

4 Rename default_addtocart.php to something sensible e.g. addtocartCategory.php  works for me

5 In the new file addtocartCategory.php replace $this->product with $product

6 Now go to the copied  default.php (the browse view for a category) and add the new add to cart template (button etc.) in the position you want
Do this somewhere between

// Show Products  and <!-- end of product -->

Using the code
Code: [Select]

<?php include 'addtocartCategory.php'; ?>


The category add to cart should then perform the same as the product add to cart.
Regards
A

Joomla 4.4.5
php 8.1

alyssaanne1

Hutson!!!


Thank you so very much for taking the time to help me!

It didn't do exactly what i was expecting but it works just great.

Thank you again!!!
I appreciate the non-judgey help

Alyssa

alyssaanne1

So i did the add... And now in category view it has a product details button instead of add to cart....

Which is fine.. However, since i did the change clicking the "add to cart" button in the browse view taken 2-3 seconds or longer for the item to show up in the cart...

Any thought on why this is?

Joomla 2.5.new one  and virtuemart 2.0.22d


Thanks so much
Alyssa

AH

Regards
A

Joomla 4.4.5
php 8.1

katw