Post by Lee_GhostRC » Sat Mar 11, 2017 8:04 pm

Hi,

This is my first post on these forums so go easy on me!

I have recently installed Opencart 2.3.0.2 moving from a very old oscommerce site. So far, I am really impressed!

One thing I was hoping someone could help with is the googlebase (merchant) feed.

On my products I have added a custom attribute 'Condition' and have entered either 'New' or 'Used' when listing products. I was hoping I may be able to edit the googlebase feed to pick this up, rather than it passing 'New' for every product.

Can someone help with the code I need to change to make this happen?

Many thanks, Lee.

Newbie

Posts

Joined
Sat Mar 11, 2017 7:40 pm

Post by dora87booth » Fri Dec 27, 2024 5:55 pm

Welcome, Lee! No worries, we're all here to help each other out.

To customize the Google Base feed to include your custom 'Condition' attribute, you'll need to modify the product feed code. Here's a general approach:

Locate the Feed Code: Find the code responsible for generating the Google Base feed in your OpenCart store. This is usually in the feeds folder.

Edit the Code: Open the relevant PHP file (e.g., googlebase.php) and locate the section where product attributes are added to the feed. You'll need to add a condition to check for your custom 'Condition' attribute and include it in the feed Marlboro Rewards

Here's a basic example of how you might modify the code:Save and Test: Save your changes and test the feed to ensure the 'Condition' attribute is correctly included.

Code: Select all

foreach ($products as $product) {
    $feed[] = array(
        'title' => $product['name'],
        'link' => $product['href'],
        'condition' => $product['condition'], // Add this line
        // Other attributes...
    );
}
Save and Test: Save your changes and test the feed to ensure the 'Condition' attribute is correctly included.

Newbie

Posts

Joined
Fri Dec 27, 2024 5:51 pm

Post by khnaz35 » Sat Dec 28, 2024 1:50 pm

dora87booth wrote:
Fri Dec 27, 2024 5:55 pm
Welcome, Lee! No worries, we're all here to help each other out.
I believe the original poster had solved this issue over 7 years ago

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia
Who is online

Users browsing this forum: No registered users and 3 guests