Jump to content

Smarty compile error ps_shoppingcart.php v3.0.0


WisQQ

Recommended Posts

Hello,
After shoppingcart module upgrade to 3.0.0 version, there is a bug which passes object to smarty compilation instead of array. Because of that site will break when trying to render cart widget.
To fix this issue, you have to change object to array inside this function:
image.thumb.png.4e959d5fb5deb9dd447b7eb557b288c3.png

    /**
     * Provides an already presented object from the context if set.
     * If not, runs the presenter.
     *
     * @return array presented cart
     */
    private function getPresentedCart()
    {
        /*
         * We will use the already presented cart in the first place. It should be already in the template.
         * Check FrontController::assignGeneralPurposeVariables for more information.
         *
         * If it's not, we will present the cart ourselves. There will always be a cart object
         * assigned in FrontController::init.
         */
        if (!empty($this->context->smarty->getTemplateVars('cart'))) {
            return (array)$this->context->smarty->getTemplateVars('cart');
        } else {
            return (new CartPresenter())->present($this->context->cart);
        }
    }

$this->context->smarty->getTemplateVars('cart'); returns object instead of array, but functions should return array.

Edited by WisQQ (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...