Add to Cart ‘buttons have disappeared.

zaccc

26 Mar, 2013 10:31 PM

I made update to the latest version of Jigoshop. Then on some products Add to Cart ‘buttons have disappeared.
I shut down all plugins except Jigoshop plugin, the problem is still the same.
http://dekica.com/shop-2/

### Begin System Info ###
Multi-site:               No
SITE_URL:                 http://dekica.com
HOME_URL:                 http://dekica.com
Jigoshop Version:         1.6.1
WordPress Version:        3.5.1
Platform:                 Windows 
Browser Name:             Opera  
Browser Version:          9.80 
User Agent String:        Opera/9.80 (Windows NT 6.1) Pres 
                              to/2.12.388 Version/12.14
PHP Version:              5.2.17
MySQL Version:            5.5.23-55
Web Server Info:          Apache
PHP Memory Limit:         256M
PHP Post Max Size:        64M
WP_DEBUG:                 Disabled
WP Table Prefix:          Length: 3 Status: Acceptable
Show On Front:            page
Page On Front:            272
Page For Posts:           27
Session:                  Enabled
Session Name:             PHPSESSID
Cookie Path:              /
Save Path:                /tmp
Use Cookies:              On
Use Only Cookies:         Off
UPLOAD_MAX_FILESIZE:      64MB
POST_MAX_SIZE:            64MB
WordPress Memory Limit:   40MB
WP_DEBUG:                 Isključen
DISPLAY ERRORS:           On (1)
FSOCKOPEN:                Vaš poslužitelj podržava fsockopen.
ACTIVE PLUGINS:
Count Per Day: 3.2.5
Facebook WPress: 2.4.2
Jigoshop: 1.6.1
JigoShop - Facebook Products: 1.21
Like Box Widget for Facebook: 1.0
RoyalSlider: 2.1
Visitor Maps and Who's Online: 1.5.8.1
W3 Total Cache: 0.9.2.8
Widget Area Manager: 1.42
WordPress SEO: 1.4.4
WP3 Newsletter: 1.0
CURRENT THEME:
Mummy Blog: 1.4
### End System Info ###
  1. Support Staff 2 Posted by Jeff on 27 Mar, 2013 03:27 AM

    Jeff's Avatar

    Ivica has asked me to take a quick look. Version 1.6.1 had some modifications to the way the Shop buttons are displayed and the actions they perform based on settings on the Catalog & Pricing tab.

    However, your site is not following standard Jigoshop behaviour and it is most likely theme related.

    Without getting too technical, here is how it should display for markup:

    http://d.pr/i/YMDS

    And how it displays on your site:

    http://d.pr/i/UAFs

    Where the Add to Cart button goes on your site, you have a <div class="add_to_cart"> wrapper that is not part of Jigoshop’s means of laying things out. So on the Shop page the following product does not display an Add to Cart button.

    http://dekica.com/shop-2/trokutici/trokutici-sa-imenom/

    If you check your theme’s functions.php, can you find a function jigoshop_template_loop_add_to_cart?

  2. 3 Posted by zaccc on 27 Mar, 2013 11:40 AM

    Hello Jeff!

    Thank you and Ivica for prompt response. I bought this theme https://jigoshop.com/product/mommy-blog/.
    The reason why I bought this template it’s made for Jigoshop. I thought it would be no problem, but unfortunately that’s emerged. The man who has made this template is known for a bad support. At least I’ve had bad experiences with it.
    I cant found his function jigoshop_template_loop_add_to_cart on functions.php

  3. 4 Posted by dtbaker on 04 Apr, 2013 06:50 AM

    The only modification made in this theme is:

    // wrapper around add to cart button
    add_action( 'jigoshop_after_shop_loop_item', 'dtbaker_add_to_cart_before', 9, 2);
    add_action( 'jigoshop_after_shop_loop_item', 'dtbaker_add_to_cart_after', 11, 2);
    function dtbaker_add_to_cart_before( $post, $_product ) {
        echo '
    
    ‘; } function dtbaker_add_to_cart_after( $post, $_product ) { echo ‘
    ';
    }
    

    Have removed that on this particular install and the buttons still do not display. Digging a bit deeper now.

  4. 5 Posted by dtbaker on 04 Apr, 2013 07:02 AM

    All custom theme jigoshop hooks were disabled (a raw “return false;” at the top of the functions.jigoshop.php theme file)

    Add to cart button still does not show.

    The only other custom theme file is ‘archive-product.php’ and this outputs the shop using: jigoshop_get_template_part( ‘loop’, ‘shop’ );

    Commenting this line out makes all products go away, so this is the template that is used. There is no loop-shop.php file in the theme.

    I do not know why the add to cart button is not displaying on some products….

    It works here on a fresh wp / jigo / theme install:
    http://mummy-blog-wordpress-theme.dtbaker.net/shop/

  5. 6 Posted by dtbaker on 04 Apr, 2013 07:18 AM

    I changed the code in jigoshop_template_functions.php to this, so that I could see which case was outputting the “empty” button code:

    if ( $_product->is_in_stock() OR $_product->is_type('external') ) {
                $button_type = Jigoshop_Base::get_options()->get_option('jigoshop_catalog_product_button');
                if ( $button_type === false ) $button_type = 'add';
                if ( $_product->is_type(array('variable', 'grouped')) ) {
                    if ( $button_type != 'none' ) {
                        if ( $button_type == 'view' ) {
                            $output = '<a href="'.esc_url(get_permalink($_product->id)).'" class="button">'.__('View Product', 'jigoshop').'</a>';
                        } else {
                            $output = '<a href="'.esc_url(get_permalink($_product->id)).'" class="button">'._x('Select', 'verb', 'jigoshop').'</a>';
                        }
                    } else {
                        $output = '1';
                    }
                } else if ( $_product->is_type('external') ) {
                    if ( $button_type != 'none' ) {
                        if ( $button_type == 'view' ) {
                            $output = '<a href="'.esc_url(get_permalink($_product->id)).'" class="button">'.__('View Product', 'jigoshop').'</a>';
                        } else {
                            $output = '<a href="'.esc_url(get_post_meta( $_product->id, 'external_url', true )).'" class="button" rel="nofollow">'.__('Buy product', 'jigoshop').'</a>';
                        }
                    } else {
                        $output = '2';
                    }
                } else if ( $button_type == 'add' ) {
                    $output = '<a href="'.esc_url($_product->add_to_cart_url()).'" class="button" rel="nofollow">'.__('Add to cart', 'jigoshop').'</a>';
                } else if ( $button_type == 'view' ) {
                    $output = '<a href="'.esc_url(get_permalink($_product->id)).'" class="button">'.__('View Product', 'jigoshop').'</a>';
                } else {
                    $output = '3'.$button_type;
                }
            } else if ( ($_product->is_type(array('grouped')) ) ) {
                $output = '4';
            } else {
                $output = '<span class="nostock">'.__('Out of Stock', 'jigoshop').'</span>';
            }
    
    (notice the numbers, 1 2 3 4 )

    The output on the page where the MISSING buttons were is “3cart”

    The $button_type of “cart” was missing

    I adjusted the core jigoshop code from:

    } else if ( $button_type == ‘view’ ) {

    to this

    } else if ( $button_type == ‘view’ || $button_type == ‘cart’ ) {

    Now the add to cart buttons are displaying.

    This was not a theme issue.

  6. 7 Posted by dtbaker on 04 Apr, 2013 07:28 AM

  7. 8 Posted by seannevo on 06 Apr, 2013 05:18 AM

    Hi dtbaker, I have also lost all my add to cart buttons, so I tried your fix but instead of ‘add to cart button’ I’m getting the ‘view product’ button. Was this line the only change I needed to make? } else if ( $button_type == ‘view’ || $button_type == ‘cart’ ) {.
    Or is there anything else I need to do to get my add to cart buttons back?
    Thank you. Sean.

  8. Support Staff 9 Posted by Jeff on 06 Apr, 2013 07:42 AM

    Jeff's Avatar

    The $button_type of “cart” was missing

    Actually, the problem was with the Jigoshop upgrade script for version 1.6.1

    function jigoshop_upgrade_161() {
        Jigoshop_Base::get_options()->add_option( 'jigoshop_catalog_product_button', **'cart'** );
    }
    

    BUT … as noted there is NO ‘cart’ button type. Apologies to all for the trouble with this.

    There should be NO changes made to the Jigoshop core. All you should really need to do is visit the Jigoshop->Settings->Catalog & Pricing tab and select the type of button you want on Catalog product buttons show … and SAVE the settings.

    Make sure to revert out any changes to that file you have made.

    Sorry for this folks.

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

If you don’t have an account yet, we need to confirm you’re human and not a machine trying to post spam.