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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:43:37+00:00 2026-06-14T13:43:37+00:00

I have a XML document and a fresh OpenCart installation. The XML Document’s content

  • 0

I have a XML document and a fresh OpenCart installation. The XML Document’s content is:
http://pastebin.com/59WeK4Qk I was able to get every tag and its value using simplexml():

$sxml = simplexml_load_file("products-sample.xml");

foreach($sxml->products->children() as $products)
{
    foreach($products->children() as $product)
    {
        echo 'Tag: '. $product->getName(). ' Value:' . $product.'<br />';
    }
    echo '<hr />';
}

But I have no coding experience in opencart, so I was wondering is there any guide or tutorial on using opencart database.

My main question is where to put that information I parse from XML?

  • 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-14T13:43:39+00:00Added an answer on June 14, 2026 at 1:43 pm

    The OpenCart database tables have mostly self-explanatory names, but there are important connections that you may overlook, such as oc_product_to_store. Some, like product_attribute or product_discount, can be ignored, depending on your exact needs.

    OpenCart allows products to be in multiple categories, and multiple stores, and some data can potentially be in multiple languages. These one-to-many connections require separate tables. There are also simple one-to-one connections like Manufacturer where the same piece of information is common to multiple products so is linked by an _id.

    I’m not going to sit here and write an import script for your data for free, but here are a few things I learned from a recent import project that I completed myself which I hope are helpful to someone.

    Your question is “where” not “how”, so I am going to assume that you already have a preferred method for executing MySQL queries within your script.

    These were the tables and fields I needed to use in an INSERT to get a product into OpenCart so it could be added to cart.

    • oc_product : model, sku, upc, ean, jan, isbn, mpn,
      location, quantity, stock_status_id, manufacturer_id,
      shipping, price, tax_class_id, date_available, status,
      date_added, date_modified, image
    • oc_product_description : product_id, language_id, name, description, meta_description, meta_keyword, tag
    • oc_product_to_store product_id, store_id
    • oc_product_to_category product_id, category_id

    You will need to first process your categories and manufacturers and add them, so you can look up their ID and use it.

    If it is at all possible that you need to UPDATE the products later using an updated XML file, you should use one of sku, upc, ean, jan, isbn, mpn to store an identifying reference (probably your code).

    To identify the correct fields and what a valid value would be, here are four simple steps:

    1. Export a backup of your database (eg with phpMyAdmin) and extract it to a text file
    2. Add one product from your XML manually using OpenCart’s admin facility (fully and properly, including setting the right Tax Class)
    3. Export and extract again, and compare the two files (eg with Beyond Compare)
    4. Look carefully at the field types (including string length) for each changed field, and work out what any _id relates to.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have xml document in variable (not in file). How can i get data
I have XML document which is something like <X><Y><Values><double>1.0</double><double>2.0</double></Values>... I am trying to get
I have an XML document that looks like this: <?xml version=1.0 encoding=UTF-8?> <xs:msgdata xmlns:xs=http://www.myCompany.com
I have an XML document with some sample content like this: <someTag> <![CDATA[Hello World]]>
I have an Xml document: <?xml version=1.0 encoding=utf-8?> <Family xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema> <Person member=father id=0>
I have xml document like below, <chapter xmlns:xi=http://www.w3.org/2001/XInclude xml:id=chapter1> <title>First chapter</title> <section xml:id=section1> <imageobject>
I have an XML document: var xml:XML = new XML(<rootNode> <head> <meta name=template content=Default
I have an XML document that I'm trying to search through. The Main structure
I have an XML document composed of several other XML documents appended to it.
I have an XML document, and I want to print the tag names and

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.