Jump to content

Invalid product vars at line 104 in file classes/Link.php


Recommended Posts

I am getting this error when i am clicking checkout button.. This is happening after i added a pack of product and i removed that pack.. Then i am getting this error. Please take this as an serious issue and solve it for me as soon as possible.

 

 

Thanks in advance

Link to comment
Share on other sites

  • 5 months later...

Open that file and find the function called public function getProductLink(

 

replace --

 

$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);

        if (!is_object($product))
        {
            if (is_array($product) && isset($product['id_product']))
                $product = new Product($product['id_product'], false, $id_lang, $id_shop);
            elseif ((int)$product)
                $product = new Product((int)$product, false, $id_lang, $id_shop);
            else
                throw new PrestaShopException('Invalid product vars');
        }

 

with

 

if (!$id_shop)
            $shop = Context::getContext()->shop;
        else
            $shop = new Shop($id_shop);
        


        if (!is_object($product))
        {
            if (is_array($product) && isset($product['id_product']))
                    $product = new Product($product['id_product'], false, $id_lang);
            else if (is_numeric($product) || !$product)
                $product = new Product($product, false, $id_lang);
            else
                throw new PrestaShopException('Invalid product vars');
        }

 

It works for me.

Link to comment
Share on other sites

×
×
  • Create New...