Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8964833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:40:36+00:00 2026-06-15T16:40:36+00:00

I don’t have that much experience with Prestashop, php, and Smarty. How do I

  • 0

I don’t have that much experience with Prestashop, php, and Smarty.
How do I get the category of lastProductAdded?
I am trying to make the “continue shopping” button redirect to the category of the last product added.

<a href="{$link->getCategoryLink($lastProductAdded.category->id)|escape:'htmlall':'UTF-8'}" class="button_large" title="{l s='Continue shopping'}">&laquo; {l s='Continue shopping'}</a>

The following code doesn’t seem to work, giving category id of 0 for some reason. (I have no idea whether it makes sense either)
Any help would be much appreciated. Thank you!

(The variable lastProductAdded and function getCategoryLink are already defined in-built)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:40:37+00:00Added an answer on June 15, 2026 at 4:40 pm

    For Prestashop 1.4.x you need to modificate Cart::getLastProduct() with this code:

    public function getLastProduct()
    {
        $sql = '
            SELECT cp.`id_product`, cp.`id_product_attribute`, p.`id_category_default`
            FROM `'._DB_PREFIX_.'cart_product` cp
            JOIN `'._DB_PREFIX_.'product` p ON (cp.`id_product` = p.`id_product`)
            WHERE `id_cart` = '.(int)($this->id).'
            ORDER BY cp.`date_add` DESC';
        $result = Db::getInstance()->getRow($sql);
        if ($result AND isset($result['id_product']) AND $result['id_product'])
            return $result;
        return false;
    }
    

    Regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't think that I'm mad, I understand how php works! That being said. I
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Don't yell at me! i have seen many threads claiming that HTML cannot be
DON'T ASK WHY but... I have a regex that needs to be case insensitive
Don't know how to explain it better but i'm trying to get a response
I don't know much about regexes and am trying to learn them. I am
don't know if the title describes anything about what I'm trying to say but
Don't ask me how but I'm in a situation where I have DCPs published

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.