WordPress.org

Support

Support » Plugins and Hacks » PrestaShop Integration » [Resolved] undefined function wppscs_getproducts()

[Resolved] undefined function wppscs_getproducts()

  • I placed this:

    [ps_product_list]

    … in a WordPress 3.5.1 page. I have version 1.5.3 of Prestashop

    I’m getting the following error in my Php_error.log file when I click the add to cart button displayed within WordPress:

    [13-Mar-2013 17:28:05] PHP Fatal error: Call to undefined function wppscs_getproducts() in {path}wp-content\plugins\php-code-widget\execphp.php(44) : eval()’d code on line 1

    Any idea? Note I’ve also applied the redirection patch to Shop.php by placing Shop.php in the override directory and adding the indicated code.

    http://wordpress.org/extend/plugins/prestashop-integration/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author aytechnet

    @aytechnet

    Hello,

    Can you try deactivating the plugin that causes problems : php code widget ? and check again ?

    There could be an action/filter/… that this plugin install and which cause incompatibility with PrestaShop ?

    François.

    After disabling the php code widget I have this error:

    TypeError: $(…).offset(…) is null

    if ($(‘#cart_block’).offset().top && $(‘#cart_block’).offset().left)

    ajax.cart.js line 219

    Plugin Author aytechnet

    @aytechnet

    This is a javascript error : since you may use some WordPress plugin already : this is a general problem here as WordPress generally use a most recent jquery library while PrestaShop not…

    But you may need (generally) to make sure the same version is used, and PrestaShop code is more tedious on this. So you need to use the PrestaShop one : you have to update your theme (or a plugin) to change jquery of WordPress to use the PrestaShop one, and you may encounter some other javascript errors… You will have to fix according to the .js files used…

    François.

    Prestashop uses jQuery 1.7.2, WordPress uses 1.8.3.

    I copied the Prestashop jQuery core file, to WordPress, disabled all plugins but the error remains.

    Also, when I dragged the Prestashop Integration Products Widget over to my side bar, all I see is the title I chose. Nothing else appears under the title.

    Plugin Author aytechnet

    @aytechnet

    Hi,

    Do never do a copy, or your WordPress administration may not work anymore ! There are method for that in you function.php of your WordPress themes !

    Can you the post the head section of your blog frontpage ?

    For the products to be visible, you need first to choose actives products under your post setting.

    François.

    For the products to be visible, you need first to choose actives products under your post setting.

    I don’t understand what that means. What active products settings? Where?

    Do never do a copy, or your WordPress administration may not work anymore !

    I’m still having the same error after I changed the way I replaced jquery.js.

    I created my own template, based on twentytwelve, with a custom functions.php that looks like this:

    function current_jquery($version) {
      wp_deregister_script('jquery');
    
      wp_register_script('jquery',
        get_theme_root_uri().'/my-twentytwelve/jquery.js',
        false, $version);
    }
    add_action( 'wp_head', current_jquery('1.8.3' ) );

    Can you the post the head section of your blog frontpage ?

    The head section of my front page looks like this:

    <!DOCTYPE html>
    <!--[if IE 7]>
    <html class="ie ie7" lang="en-US">
    <![endif]-->
    <!--[if IE 8]>
    <html class="ie ie8" lang="en-US">
    <![endif]-->
    <!--[if !(IE 7) | !(IE 8)  ]><!-->
    <html lang="en-US">
    <!--<![endif]-->
    <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />
    <title>Sample Page | Test Site</title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="http://localhost/myphp/wordpress/w/xmlrpc.php" />
    <!--[if lt IE 9]>
    <script src="http://localhost/myphp/wordpress/w/wp-content/themes/twentytwelve/js/html5.js" type="text/javascript"></script>
    <![endif]-->
    <meta name='robots' content='noindex,nofollow' />
    <link rel="alternate" type="application/rss+xml" title="Test Site &raquo; Feed" href="http://localhost/myphp/wordpress/w/?feed=rss2" />
    <link rel="alternate" type="application/rss+xml" title="Test Site &raquo; Comments Feed" href="http://localhost/myphp/wordpress/w/?feed=comments-rss2" />
    <link rel="alternate" type="application/rss+xml" title="Test Site &raquo; Sample Page Comments Feed" href="http://localhost/myphp/wordpress/w/?feed=rss2&page_id=2" />
    <link rel='stylesheet' id='admin-bar-css'  href='http://localhost/myphp/wordpress/w/wp-includes/css/admin-bar.min.css?ver=3.5.1' type='text/css' media='all' />
    <link rel='stylesheet' id='twentytwelve-fonts-css'  href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700&subset=latin,latin-ext' type='text/css' media='all' />
    <link rel='stylesheet' id='twentytwelve-style-css'  href='http://localhost/myphp/wordpress/w/wp-content/themes/my-twentytwelve/style.css?ver=3.5.1' type='text/css' media='all' />
    <!--[if lt IE 9]>
    <link rel='stylesheet' id='twentytwelve-ie-css'  href='http://localhost/myphp/wordpress/w/wp-content/themes/twentytwelve/css/ie.css?ver=20121010' type='text/css' media='all' />
    <![endif]-->
    <script type='text/javascript' src='http://localhost/myphp/wordpress/w/wp-includes/js/comment-reply.min.js?ver=3.5.1'></script>
    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/myphp/wordpress/w/xmlrpc.php?rsd" />
    <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/myphp/wordpress/w/wp-includes/wlwmanifest.xml" />
    <link rel='next' title='Products Page' href='http://localhost/myphp/wordpress/w/?page_id=4' />
    <meta name="generator" content="WordPress 3.5.1" />
    <link rel='canonical' href='http://localhost/myphp/wordpress/w/?page_id=2' />
    <script type="text/javascript">
      var baseDir = 'http://localhost/myphp/prestashop/p/';
      var baseUri = '/myphp/prestashop/p/';
      var static_token = '66699001af95224ba32f8e59ed597d59';
      var token = '641b522c8edee7accc8febca17d0d30e';
      var priceDisplayPrecision = 2;
      var priceDisplayMethod = 0;
      var roundMode = 2;
    </script>
    <link href="/myphp/prestashop/p/themes/myCustomTheme/css/global.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockbestsellers/blockbestsellers.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockpermanentlinks/blockpermanentlinks.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockviewed/blockviewed.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockcart/blockcart.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockcontact/blockcontact.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockspecials/blockspecials.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockcurrencies/blockcurrencies.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blocknewproducts/blocknewproducts.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockmyaccountfooter/blockmyaccount.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockuserinfo/blockuserinfo.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blocklanguages/blocklanguages.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blocktags/blocktags.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/js/jquery/plugins/autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/themes/myCustomTheme/css/product_list.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blocksearch/blocksearch.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/favoriteproducts/favoriteproducts.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/homefeatured/homefeatured.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blocknewsletter/blocknewsletter.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/paypal/css/paypal.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blocktopmenu/css/superfish-modified.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/myphp/prestashop/p/modules/blockreinsurance/style.css" rel="stylesheet" type="text/css" media="all" />
    <script type="text/javascript" src="/myphp/prestashop/p/js/jquery/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/myphp/prestashop/p/js/jquery/plugins/jquery.easing.js"></script>
    <script type="text/javascript" src="/myphp/prestashop/p/js/tools.js"></script>
    <script type="text/javascript" src="/myphp/prestashop/p/modules/blockcart/ajax-cart.js"></script>
    <script type="text/javascript" src="/myphp/prestashop/p/themes/myCustomTheme/js/tools/treeManagement.js"></script>
    <script type="text/javascript" src="/myphp/prestashop/p/js/jquery/plugins/autocomplete/jquery.autocomplete.js"></script>
    <script type="text/javascript" src="/myphp/prestashop/p/modules/favoriteproducts/favoriteproducts.js"></script>
    <script type="text/javascript" src="/myphp/prestashop/p/modules/blocktopmenu/js/hoverIntent.js"></script>
    <script type="text/javascript" src="/myphp/prestashop/p/modules/blocktopmenu/js/superfish-modified.js"></script>
    <script type="text/javascript">
      var favorite_products_url_add = 'http://localhost/myphp/prestashop/p/index.php?process=add&fc=module&module=favoriteproducts&controller=actions';
      var favorite_products_url_remove = 'http://localhost/myphp/prestashop/p/index.php?process=remove&fc=module&module=favoriteproducts&controller=actions';
    
    </script>
    
    <link rel="alternate" type="application/rss+xml" title="my test shop" href="http://localhost/myphp/prestashop/p/modules/feeder/rss.php?id_category=0&orderby=position&orderway=asc" /><script type="text/javascript">
    $(document).ready( function() {
    
      $('#payment_paypal_express_checkout').click(function() {
        $('#paypal_payment_form').submit();
        return false;
      });
    
      $('#paypal_payment_form').live('submit', function() {
        var nb = $('#quantity_wanted').val();
        var id = $('#idCombination').val();
    
        $('#paypal_payment_form input[name=quantity]').val(nb);
        $('#paypal_payment_form input[name=id_p_attr]').val(id);
      });
    
      function displayExpressCheckoutShortcut() {
        var id_product = $('input[name="id_product"]').val();
        var id_product_attribute = $('input[name="id_product_attribute"]').val();
    
        $.ajax({
          type: "GET",
          url: baseDir+'/modules/paypal/express_checkout/ajax.php',
          data: { get_qty: "1", id_product: id_product, id_product_attribute: id_product_attribute },
          cache: false,
          success: function(result) {
            if (result >= '1')
              $('#container_express_checkout').slideDown();
            else
              $('#container_express_checkout').slideUp();
            return true;
          }
        });
      }
    
      $('select[name^="group_"]').change(function () {
        displayExpressCheckoutShortcut();
      });
    
      $('.color_pick').click(function () {
        displayExpressCheckoutShortcut();
      });
    
      var modulePath = 'modules/paypal';
      var subFolder = '/integral_evolution';
      var fullPath = baseDir + modulePath + subFolder;
      var confirmTimer = false;
    
      if ($('form[target="hss_iframe"]').length == 0) {
        if ($('select[name^="group_"]').length > 0)
          displayExpressCheckoutShortcut();
        return false;
      } else {
        checkOrder();
      }
    
      function checkOrder() {
        confirmTimer = setInterval(getOrdersCount, 1000);
      }
    
      });
    
    </script> <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
    <style type="text/css" media="print">#wpadminbar { display:none; }</style>
    <style type="text/css" media="screen">
      html { margin-top: 28px !important; }
      * html body { margin-top: 28px !important; }
    </style>
    Plugin Author aytechnet

    @aytechnet

    Ok,

    There are some WordPress javascript file, but it may not be problematic.

    I don’t understand what that means. What active products settings? Where?

    When you edit a post, you can associate products to this post so that they are visible using the products wdiget. If you have not attached any products, there are no products visible. Check on your post the “PrestaShop Integration” section.

    Your javascript error seems to be caused by the fact the cart is not visible, add the PrestaShop Integration hooks (or module) so that the cart becomes visible.

    François.

    Ok, I understand this now:

    For the products to be visible, you need first to choose active products under your post setting.

    So, I added a couple of product ids to a blog post and now the product appear in the side bar. BUT, on a page (rather than a blog post) and on a blog post that isn’t linked to any active products, I will still get just a title in the side bar with no products under it. It would be better if there was no title when there are no products linked to a blog post. Is there a way for me to hide the title when there are no linked products?

    I also moved this : [ps_product_list] from a wordpress page to a wordpress blog post but I still get the same error when I click add to cart.

    TypeError: $(...).offset(...) is null
    if ($('#cart_block').offset().top && $('#cart_block').offset().left)
    ajax.cart.js line 219

    It seems to be because there is no element with an id of “cart_block” which I confirmed by using Firefox to view source and then I searched for “cart_block”

    Where is “cart_block” supposed to be?

    Plugin Author aytechnet

    @aytechnet

    You can avoid a title to set, or fix the theme (generally a custom theme is needed to have the same look&feel between the blog and the shop).

    “cart_block” is the cart block (or the basket) where you put the product inside to buy them (generally on the right columns).

    François.

    “cart_block” is the cart block (or the basket) where you put the product inside to buy them (generally on the right columns).

    Sounds like I need to do something to get the shopping cart basket to appear on my WordPress site. I’m guessing that doesn’t happen automatically and I’ve missed a step somewhere?

    Plugin Author aytechnet

    @aytechnet

    You can use PrestaShop Integration Hook widget, in order to show the whole left column (or right column) where your basket is…

    Now I get it. I dragged this widget:

    Prestashop Integration Module

    .. to the side bar, selected “blockcart” as the module and “Top of Pages” as the Hook.

    Now everything seems to be working.

    Thank you very much for all your help and of course for sharing this WordPress plugin. Now that I can see it working, this is great!

    Plugin Author aytechnet

    @aytechnet

    Ok, fine !

    Please do not forget to mark it as resolved in the future (I do it) and gives an evaluation of the plugin so if you like it…

    François.

    Please do not forget to mark it as resolved

    Oops. Sorry about that.

    I also added a review. 5 stars.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Resolved] undefined function wppscs_getproducts()’ is closed to new replies.
Skip to toolbar