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 8559743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:07:25+00:00 2026-06-11T16:07:25+00:00

Hello guys, Thanks in advance. I am new to opencart and am currently developing

  • 0

Hello guys,

Thanks in advance.
I am new to opencart and am currently developing a shopping cart in opencart and everything was going smoothly but I got stuck, help please

I want to access currently added cart items in checkout.tpl for generating an inquiry form, so I was editing controller/checkout.php and added these lines of code to access product details that are currently in the cart:

    //Product detail for Enquiry    
    $product_data = array();

    foreach ($this->cart->getProducts() as $product) {
        $option_data = array();

        foreach ($product['option'] as $option) {
            if ($option['type'] != 'file') {
                $value = $option['option_value'];   
            } else {
                $value = $this->encryption->decrypt($option['option_value']);
            }   

            $option_data[] = array(
                'product_option_id'       => $option['product_option_id'],
                'product_option_value_id' => $option['product_option_value_id'],
                'option_id'               => $option['option_id'],
                'option_value_id'         => $option['option_value_id'],                                   
                'name'                    => $option['name'],
                'value'                   => $value,
                'type'                    => $option['type']
            );                  
        }

        $product_data[] = array(
            'product_id' => $product['product_id'],
            'name'       => $product['name'],
            'model'      => $product['model'],
            'option'     => $option_data,
            'download'   => $product['download'],
            'quantity'   => $product['quantity'],
            'subtract'   => $product['subtract'],
            'price'      => $product['price'],
            'total'      => $product['total'],
            'tax'        => $this->tax->getTax($product['price'], $product['tax_class_id']),
            'reward'     => $product['reward']
        ); 
    }

    $data['products'] = $product_data;

and then added a line in checout/checkout.tpl :

    foreach ($products as $product)
    {
        echo 'yes am getting products details';
    }

but still getting error: Undefined variable: products ?

Am I doing it right? please correct me.

  • 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-11T16:07:27+00:00Added an answer on June 11, 2026 at 4:07 pm

    What you have done is almost correct, however you’ve used

    $data['products'] = $product_data;
    

    where you should have put

    $this->data['products'] = $product_data;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PLEASE READ THE FULL QUESTION BEFORE POST YOUR ANSWER Hello guys! I'm currently developing
Hello guys I can't provide the code but you can see it on the
Hello guys. I think it isn't possible just using PHP, but just to be
hello guys I am trying to extract all the anchor links from aol but
Hello guys and thanks for your help as always. I am stuck on Asp.NET
What I'm trying to do Hello Guys. I got a Service which, set's a
Hello guys I have a DIV that I got passed trought a js function
Hello is nice to be a new member of the community and thanks for
Hello guys I'm new to php and I discovered that for a database connection
Is Visual Studio 2010 compatible with MVC 1.0 Hello guys, Thanks for reading in

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.