Author Topic: No add to cart showing on browse  (Read 40728 times)

StormIT

  • Jr. Member
  • **
  • Posts: 55
Re: No add to cart showing on browse
« Reply #30 on: February 03, 2010, 00:10:32 am »
@yourmanstan Thank you, thank you thank you thank you thank you!!!

Perfect! Work's great!!

cousinisaac

  • Beginner
  • *
  • Posts: 18
Re: No add to cart showing on browse
« Reply #31 on: February 11, 2010, 13:34:55 pm »
Greg and Xenux's solution works for me except now if a child item in a drop down is out of stock then simply selecting the drop down sends the user to the flypage rather than swapping out the add to cart button with  'notify me' right away.

Also, rather than overwriting the file addtocart_form.tp.php in the browse/includes/ folder with the one from the product_details folder, I simply changed the following line in shop.browse.php

Code: [Select]
$products[$i]['form_addtocart'] = $tpl->fetch( browse/includes/addtocart_form.tpl.php' );   

Code: [Select]
$products[$i]['form_addtocart'] = $tpl->fetch( 'product_details/includes/addtocart_form.tpl.php' );  // was browse/includes/addtocart_form.tpl.php 


______________________________________
Using, joomla 1.5.15 and VM 1.1.4

cousinisaac

  • Beginner
  • *
  • Posts: 18
Re: No add to cart showing on browse
« Reply #32 on: February 11, 2010, 16:20:35 pm »
I take that back- if the product is a 'multi' product- that is, if it has a parent and several children with separate sku's then it will send the user to the flypage upon changing the dropdown.  If I can come up with a fix, I'll post it here.
______________________________________
Using, joomla 1.5.15 and VM 1.1.4

cousinisaac

  • Beginner
  • *
  • Posts: 18
Re: No add to cart showing on browse
« Reply #33 on: February 12, 2010, 19:42:01 pm »
I figured out why using a dropdown list with products with children sends the user to the flypage rather than updating the browse page. The file administrator/components/com_virtuemart/classes/ps_product_attribute.php  is the culprit.

Look for this code
Code: [Select]
// If content plugins are enabled, reload the whole page; otherwise, use ajax
if( VM_CONTENT_PLUGINS_ENABLE == '1' ) {
$html .= "<select class=\"inputbox\" onchange=\"var id = $('product_id_field')[selectedIndex].value; if(id != '') { document.location = '" . $mm_action_url . "index.php?option=com_virtuemart&amp;page=shop.product_details&amp;flypage=$flypage&amp;Itemid=$Itemid&amp;category_id=$category_id&amp;product_id=' + id; }\" id=\"product_id_field\" name=\"prod_id[]\">\n" ;
} else {
$html .= "<select class=\"inputbox\" onchange=\"var id = $('product_id_field')[selectedIndex].value; if(id != '') { loadNewPage( 'vmMainPage', '" . $mm_action_url . "index.php?option=com_virtuemart&amp;page=shop.product_details&amp;flypage=$flypage&amp;Itemid=$Itemid&amp;category_id=$category_id&amp;product_id=' + id ); }\" id=\"product_id_field\" name=\"prod_id[]\">\n" ;
}
 

I simply got rid of all of it and replaced it with

Code: [Select]
$html .= "<select class=\"inputbox\" onchange=\"var id = $('product_id_field')[selectedIndex].value;\" id=\"product_id_field\" name=\"prod_id[]\">\n" ;
This is a temporary solution and it kills the ability to refresh the page either with ajax or normally, so the add to cart button doesn't dynamically become a "notify me" button if the product is out of stock, but it will send the user to the notify me page if they try to add an out of stock item to their cart.

I also have yet to figure out how to get attributes to appear, but I haven't really tried yet. Hope this helps at least get products with children to and dropdown lists onto your browse page. Not sure if others had the same issue as I, but there it is, for what it's worth.

______________________________________
Using, joomla 1.5.15 and VM 1.1.4

sethniel

  • Beginner
  • *
  • Posts: 8
Re: No add to cart showing on browse
« Reply #34 on: February 28, 2010, 19:55:28 pm »
That's great, I'm waiting for the final solution. :) Thanks a lot!

sethniel

  • Beginner
  • *
  • Posts: 8
Re: No add to cart showing on browse
« Reply #35 on: March 21, 2010, 23:25:09 pm »
I have a problem. I can't add the parent product to the cart... any solution for this?

borisost

  • Beginner
  • *
  • Posts: 1
Re: No add to cart showing on browse
« Reply #36 on: April 25, 2010, 21:25:55 pm »
Hi guys!

I made an implementation of this hack and from functionality side it work perfectly: I can choose an additional product  attribute and add a product to the cart.
But I have some strange issue with it: the “add to cart” of the first product is different from others.
I tried to solve this issue by my own but did not succeed with it.
You can take a look on it here:
http://ladysmania.com/en/home?page=shop.browse&category_id=3

May be somebody also deal with this issue?

Thank you.


la77

  • Beginner
  • *
  • Posts: 1
Re: No add to cart showing on browse
« Reply #37 on: July 08, 2010, 13:00:25 pm »
Hello Evrybody!

A try to use that a found here. Its working but in my page heve 2 notice lines.


What can I do to remove this lines?

I use joomla 1.5.15 (1.0 compatible mode) and VM 1.1.4.

Update:
In localhost: turn off php settings / display errors and the notice lines disappear.

6DS

  • Beginner
  • *
  • Posts: 43
    • 6DS.biz
Re: No add to cart showing on browse
« Reply #38 on: November 28, 2010, 08:26:49 am »
Hi gregdev,

I applied your patch which worked as mentioned above. However doing some testing and when you click on Add to Cart it says added to cart, but the product has not been added to the cart. Basically want it to be able to redirect to the product flypage. Also can i remove the quantity and arrrows boxes from the browse page as per above. The products have attributes and the user need to select the attributes before they can add to cart, so would like it that when user clicks on the add to cart button in the browse page that the user is redirected to that product flypage.

Hope this makes sense.

Andrew
i have the same problem...
a redirection to the flypage if the product has attributes would be perfect!
can anybody help me?!

Hello, I have fixed this on a site I'm currently developing.

The solution in VM 1.1.5 shop.browse.php:

Code: [Select]
// Add-to-Cart Button
if (USE_AS_CATALOGUE != '1' && $product_price != ""
&& $tpl->get_cfg( 'showAddtocartButtonOnProductList' )
&& !stristr( $product_price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL') )
&& !ps_product::product_has_attributes( $db_browse->f('product_id'), true )) {

$tpl->set( 'i', $i );
$tpl->set( 'product_id', $db_browse->f('product_id') );
$tpl->set( 'product_in_stock', $db_browse->f('product_in_stock') );
$tpl->set( 'ps_product_attribute', $ps_product_attribute );
$products[$i]['form_addtocart'] = $tpl->fetch( 'browse/includes/addtocart_form.tpl.php' );
$products[$i]['has_addtocart'] = true;
}
else {
$tpl->set( 'product_flypage', $url );
$products[$i]['form_addtocart'] = $tpl->fetch( 'browse/includes/addtocart_attr.tpl.php' );
$products[$i]['has_addtocart'] = true;
}
I have made the changes in the else loop:
Set variable Product_details to URL and pass through to new template
Fetch new template page
Set addtocart to true from false.

Contents of browse/includes/addtocart_attr.tpl.php (this can be any file):
Code: [Select]
<a class="button" href="<?php echo $product_flypage ?>" title="<?php echo $product_details ?>">Select Product Size</a>
As you can see it's just a simple link that makes a button to link to product flypage.

If you are interested in seeing this in a development environment, please PM me.

6DS

  • Beginner
  • *
  • Posts: 43
    • 6DS.biz
Re: No add to cart showing on browse
« Reply #39 on: December 01, 2010, 05:21:19 am »
Update:
I now have product attributes (size/color etc.) showing on the category browse page, thanks to these tips in this thread. We do not use stock management feature.

http://forum.virtuemart.net/index.php?topic=39011.msg221375#msg221375
http://forum.virtuemart.net/index.php?topic=39011.msg196410#msg196410
http://forum.virtuemart.net/index.php?topic=39011.msg186245#msg186245
http://forum.virtuemart.net/index.php?topic=39011.msg196410#msg196410
http://forum.virtuemart.net/index.php?topic=39011.msg221375#msg221375

(I think it was these ones, I'll double check my code if you let me know that just doing these doesn't work.)

As soon as the site is out of development later this week I'll post up the URL and you can see.

6DS

  • Beginner
  • *
  • Posts: 43
    • 6DS.biz
Re: No add to cart showing on browse
« Reply #40 on: December 14, 2010, 20:48:42 pm »
Here is the production site that this work was done on:

http://www.houseofgrafix.net

airmvp23

  • Beginner
  • *
  • Posts: 6
Re: No add to cart showing on browse
« Reply #41 on: April 14, 2011, 22:31:52 pm »
6DS thanks for putting that information together.  For some reason I still can't get it to work.  I was able to get it as far as putting the attributes (drop-down) and an add to cart button, but it won't add to the cart.

Can you email or post how you got your site working/looking that way?

In addition, I am trying to have 2 Add to Cart buttons. 1 for each attribute instead of a drop-down menu if anyone can point me in the right direction.

Thanks to everyone's hard work on this.

mercomarine

  • Jr. Member
  • **
  • Posts: 129
    • Merco Marine
Re: No add to cart showing on browse
« Reply #42 on: May 10, 2011, 15:42:16 pm »
Hey Greg,

I did as you stated above

Quote
In administrator/components/com_virtuemart/html/shop.browse.php, look for these lines (400-404):

Code:

      // Add-to-Cart Button
      if (USE_AS_CATALOGUE != '1' && $product_price != ""
         && !stristr( $product_price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL') )
         && !ps_product::product_has_attributes( $db_browse->f('product_id'), true )
         && $tpl->get_cfg( 'showAddtocartButtonOnProductList' ) ) {


You could try one of these options:

1. Change the second parameter of product_has_attributes() to false:
Code:

      // Add-to-Cart Button
      if (USE_AS_CATALOGUE != '1' && $product_price != ""
         && !stristr( $product_price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL') )
         && !ps_product::product_has_attributes( $db_browse->f('product_id'), false )
         && $tpl->get_cfg( 'showAddtocartButtonOnProductList' ) ) {

However, when I click on the new add to cart button it takes me to the product details page of where that attribute options are displayed the default add to cart quantity displays as "0" and not "1" so if the customer doesnt change that number to 1 they are redirected to a page that says something like "product does not exist" and they get a listing of all of our products.

Do you know how I could change that default to 1 and not 0? 
Joomla Version 1.5.23
VirtueMart 1.1.9 stable
Apache: 1.3.42
MySQL 5.0.91
PHP: 5.2.5
phpMyAdmin 3.3.10.2

marianaf

  • Beginner
  • *
  • Posts: 24
Re: No add to cart showing on browse
« Reply #43 on: May 19, 2011, 20:54:15 pm »
Hello, is there a final solution for this? with no redirecting to flypgae afetr picking an item on the browse page?

i really need it..

thank you

new12

  • Beginner
  • *
  • Posts: 35
Re: No add to cart showing on browse
« Reply #44 on: July 20, 2011, 03:42:33 am »
Hello,
I've got it working per the instructions, but the text for the attribute title is right-justified (see screenshot).  Is there any way to left-justify the text?  This would be awesome!

Evan

[attachment cleanup by admin]