Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SUPPORT : XML Export contribution


expert

Recommended Posts

It is ready actually, but my posts have been deleted related XML Core System Engine bu admins.

Actually they don't realize that this engine will extend usage of osCommerce very efficiently.

 

I need wordwide XML data feederd to add modules for this engine.

 

Please provide me some XML samples from suppliers. [email protected]

 

http://english.duzgun.com for more information

 

Regards,

 

Hi, if I think this is what I think it is I am interested into having a look at this.

 

I have several supplier feeds I want to integrate into my site, then export it to other Os commerec sites.

 

Would you import and export xml files be of use to me?

 

 

Thanks

Johnny

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

  • Replies 77
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

the export works great, but I dont appear to be ouputting my options(attributes of which I have many for some products and others none).

 

Caan you advise on an update

 

 

Thanks

Johnny

 

Merry Christmas and a Hppy New Year

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Hi,

 

I have started to get to grips with an import of a feed for my own site. (well learning the basics)

 

However I have two issues.

 

issue 1) they are using CDATA for some fields and I do not know how to get the information contained within this CDATA extracted.

 

issue 2) some of the options are done as |option1|option2|option3

 

can anyone advise how I get round these issues so I can import usefull information to the database.

 

Thanks

 

Johnny

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Okay,

 

I have cobbled together some script, it currently reads the xml file drop.xml and inserts data into the datbase.

 

However, it only inserts the last set of data in the xml file, so obviously I have a problem the loop cycle and reading each entry. And I am not overly knowkledgeable so reading books and looking at script to work out to do this has got me this far.

 

Secondly, I need to change the image file so it saves to my image directory and then rewrites the location of the img file as currently it inserts the full path of the suppliers image.

 

my code is as follows:-

 

<?php
include("includes/application_top.php");
if (!($fp=@fopen("./drop.xml", "r"))) die ("Couldn't open XML.");
$usercount=0;
$userdata=array();
$state='';

function startElementHandler ($parser,$name,$attrib){
global $usercount;
global $userdata;
global $state;

switch ($name) {
case $name=="PRODUCT" : {
$userdata[$usercount]['item'] = $attrib['ITEM'];
break;
}

default : {$state=$name;break;}
}
}

function endElementHandler ($parser,$name){
global $usercount;
global $userdata;
global $state;
$state='';
if($name=="CONTACT") {$usercount++;}
}

function characterDataHandler ($parser, $data) {
global $usercount;
global $userdata;
global $state;
if (!$state) {return;}
if ($state=="MODEL") { $userdata[$usercount]['dmodel'] = $data;}
if ($state=="NAME") { $userdata[$usercount]['dname'] = $data;}
if ($state=="DESCRIPTION") { $userdata[$usercount]['ddescr'] = $data;}
if ($state=="DIMENSION") { $userdata[$usercount]['ddimens'] = $data;}
if ($state=="PRICE") { $userdata[$usercount]['dprice'] = $data;}
if ($state=="DELIVERY") { $userdata[$usercount]['ddliv'] = $data;}
if ($state=="QUANTITY") { $userdata[$usercount]['ddqty'] = $data;}
if ($state=="IMAGE_URL") { $userdata[$usercount]['dimage'] = $data;}
if ($state=="CATEGORIES") { $userdata[$usercount]['dcat'] = $data;}
}
if (!($xml_parser = xml_parser_create())) die("Couldn't create parser.");
xml_set_element_handler( $xml_parser, "startElementHandler", "endElementHandler");
xml_set_character_data_handler( $xml_parser, "characterDataHandler");

while( $data = fread($fp, 4096)){
if(!xml_parse($xml_parser, $data, feof($fp))) {
break;}}
xml_parser_free($xml_parser);

?>
<html>
<head><title>CodeHelp - Testing PHP XML parser</title>
</head>
<body>
<?php
for ($i=0;$i<$usercount; $i++)
{


	 echo "Product: ".$userdata[$i]['ITEM']."<br>"; }




$insert_query1= "INSERT INTO `products` (`products_quantity`,`products_model`,`products_image`,`products_price` ,
`products_date_added`,`products_last_modified`,`products_date_available`,`products_weight`,`products_status`,
`products_tax_class_id`,`manufacturers_id`,`products_ordered`) VALUES ('" .($userdata[$i]['ddqty']). "','" .($userdata[$i]['dmodel']). "','" .($userdata[$i]['dimage']). "','" .($userdata[$i]['dprice']). "','',NULL,NULL,'" .($userdata[$i]['ddliv']). "','','',NULL,'0'
)";


$insert_query2= "INSERT INTO `products_description` (`language_id`,`products_name`,`products_description`,`products_url`,`products_viewed`) VALUES ('1','" .($userdata[$i]['dname'])."','" .($userdata[$i]['ddescr'])."','','')";
  @$insert_result1 = tep_db_query($insert_query1);
	 @$insert_result2 = tep_db_query($insert_query2);





if ($insert_result1) echo '.<BR>New product entered.<BR>';
if ($insert_result2) echo 'New description entered.<BR>';


?>
</table>
</body><html>

 

Any advice is greatly recieved, and I am probably going around this the wrong way, but at least I can read the xml file from the supplier and get the data into my database even if its only the one entry.

 

The two Inserts for the database relate to the products table and the product description table, not looked at the attributes or categories yet. and there is still work to do on the other tables, juts would like the loop to work for now. so I could insert r=the 2,000 plus records, rather than just the one.

Edited by johnnybebad

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Your loop "end": } is here:

		 echo "Product: ".$userdata[$i]['ITEM']."<br>"; }

Should move it to below

if ($insert_result2) echo 'New description entered.<BR>';

Hi, must have more than jjust that wrong, have to have a nother look, thanks for your help.

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

  • 1 month later...
Hi guys,

i need some help pls.

I having the following error when i want to export:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 10000' at line 50

 

 

I only getting this error when we export articles whiteout a sub category....

Edited by charley1001
Link to comment
Share on other sites

  • 2 weeks later...
I did what you said here and keep getting this message when I click on xml Export in my admin: 404 not found

 

The requested resource could not be found.

 

Am I missing something or is there another way to run this php file to export my catalog.

Thanks

David

 

I am ...

1 - a newbie

2 - using the "Administration level account with categories 2.3.1" contribution ... and it works.

3 - getting a message that reads:

 

No Right Permission Access

Please contact your Web Administrator to request

more access or if you found any problem.

 

I'm lost. I have tried everything (well, almost everything). I am desperate.

 

Please help.

Link to comment
Share on other sites

  • 4 weeks later...

I'm also having problem wit XML export contribution

 

When i run xml_export.php i get:

 

Snowbird/Expert osC XML Export

Select Category Fatal error: Call to undefined function tep_get_category_tree() in /public_html/xml_export.php on line 251

 

 

If I delete "tep_get_category_tree()" in xml_export.php file I get:

 

Snowbird/Expert osC XML Export

Select Category

File Type and Name (without extention) Download

 

 

It seems OK, but there are no categories to select in drop down menu.

 

Any help, I realy need to export in xml file.

 

Tnx

Link to comment
Share on other sites

Ok, It is working, I just need to put in /admin

 

 

Now another problem, how to make file to export in this form:

 

<?xml version="1.0" encoding="WINDOWS-1250" standalone="yes" ?>

<shop id="mySTORE">

<product>

<productID>032149</produsctID>

<productName>Clive Barker's Undying</productName>

<last_refresh>21/07/1999</last_refresh>

<url>http://www.mystore.com/product.asp?dept_id=311&pf_id=032149</url>

<description> bla bla bla

</description>

<pictures>

<picture href="http://www.abc.si/slike/slika9837a.jpg" />

<picture href="http://www.abc.si/slike/slika9837b.jpg" />

<picture href="http://www.abc.si/slike/slika9837c.jpg" />

</pictures>

<price>100</price>

<CategoryID>142</CategoryID>

</product>

Link to comment
Share on other sites

  • 1 month later...
3 - getting a message that reads:

 

No Right Permission Access

Please contact your Web Administrator to request

more access or if you found any problem.

 

I'm lost. I have tried everything (well, almost everything). I am desperate.

 

Please help.

 

I have same problem.

xml_export.php -> $export_folder = 'dataexport'; // folder name that XML files to be created. should be under /catalog/ main folder.

 

dataexport folder is under main "/ " -> /catalog/dataexport with rights 777

catalog - folder, where my store is placed (root folder)

Any idea what's wrong?

Link to comment
Share on other sites

I have same problem.

xml_export.php -> $export_folder = 'dataexport'; // folder name that XML files to be created. should be under /catalog/ main folder.

 

dataexport folder is under main "/ " -> /catalog/dataexport with rights 777

catalog - folder, where my store is placed (root folder)

Any idea what's wrong?

 

Ok, solved. PA - rights settings for Admin

Link to comment
Share on other sites

Expert,

 

There is an issue with the xml export in that if there is an "&" in the image file name or brand (mfr) name, it will not change it to & which is the appropriate xml display of an "&", causing the file to fail if you parse it.

 

Just letting you know.

 

Expert, is it fixed or not? How to solve this problem?

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...

hi guys

 

Just a question about formatting

 

Currently we use formating for title of product like this;

 

<b>Title</b><br>best model

 

now, export gives out result

 

<Product_Name><b>Title</b><br>best model</Product_Name>

 

any idea how to make this to display correctly?

 

Thank you in advance

Link to comment
Share on other sites

  • 4 weeks later...

I only getting this error when we export articles whiteout a sub category....

Same problem here, if i export a category without subcategories everything is ok, bun when i try to export directly a subcategory only...i get that error:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 10000' at line 50

 

SELECT manuf.manufacturers_Name AS manufacturer, prd.products_id AS id, prd.products_id AS mpc, prd.products_model AS model, prd.products_quantity AS qty, prdsc.products_Name AS name, prdsc.products_description AS description, prd.products_price AS price, prd.products_image AS image, prd.products_weight AS weight, prd.products_status AS status, prd.products_date_available AS date_available, prd.products_last_modified AS last_modified, prd.products_tax_class_id AS tax_id, catdescparent4.categories_Name AS parent4_cat, catdescparent3.categories_Name AS parent3_cat, catdescparent2.categories_Name AS parent2_cat, catdescparent1.categories_Name AS parent1_cat, catdesccurrent.categories_Name AS current_cat, catdescparent4.categories_id AS parent4_id, catdescparent3.categories_id AS parent3_id, catdescparent2.categories_id AS parent2_id, catdescparent1.categories_id AS parent1_id, catdesccurrent.categories_id AS current_id FROM (categories , products prd, products_description AS prdsc, categories_description AS catdesccurrent, products_to_categories AS prdtocat) LEFT JOIN categories_description AS catdescparent1 on ( catdescparent1.categories_id = categories.parent_id AND catdescparent1.language_id = '1' ) LEFT JOIN categories AS cat2 on ( cat2.categories_id = categories.parent_id ) LEFT JOIN categories_description AS catdescparent2 on ( catdescparent2.categories_id = cat2.parent_id AND catdescparent2.language_id = '1' ) LEFT JOIN categories AS cat3 on ( cat3.categories_id = cat2.parent_id ) LEFT JOIN categories_description AS catdescparent3 on ( catdescparent3.categories_id = cat3.parent_id AND catdescparent3.language_id = '1' ) LEFT JOIN categories AS cat4 on ( cat4.categories_id = cat3.parent_id ) LEFT JOIN categories_description AS catdescparent4 on ( catdescparent4.categories_id = cat4.parent_id AND catdescparent4.language_id = '1' ) LEFT JOIN manufacturers AS manuf ON ( manuf.manufacturers_id = prd.manufacturers_id ) WHERE ( prd.products_id = prdsc.products_id AND prdsc.language_id = '1' ) AND prd.products_id = prdtocat.products_id AND prdtocat.categories_id = categories.categories_id AND ( catdesccurrent.categories_id = categories.categories_id AND catdesccurrent.language_id = '1' ) AND prdtocat.categories_id in () LIMIT 10000

 

[TEP STOP]

Edited by anuksamun
Link to comment
Share on other sites

  • 4 months later...

Hi,

Thanks for this contribute....excellent...i love it... however i am getting error when i look at the XML files... here is the error message..

 

XML Parsing Error: not well-formed

Location: http://domain.com/location/exportfile.xml

Line Number 1346, Column 32: <Product_Manufacturer>BLACK & DECKER</Product_Manufacturer>

----------------------------------------------------------------------------------------------------^

 

any help please.....

 

thank you!

 

 

Same problem here, if i export a category without subcategories everything is ok, bun when i try to export directly a subcategory only...i get that error:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 10000' at line 50

 

SELECT manuf.manufacturers_Name AS manufacturer, prd.products_id AS id, prd.products_id AS mpc, prd.products_model AS model, prd.products_quantity AS qty, prdsc.products_Name AS name, prdsc.products_description AS description, prd.products_price AS price, prd.products_image AS image, prd.products_weight AS weight, prd.products_status AS status, prd.products_date_available AS date_available, prd.products_last_modified AS last_modified, prd.products_tax_class_id AS tax_id, catdescparent4.categories_Name AS parent4_cat, catdescparent3.categories_Name AS parent3_cat, catdescparent2.categories_Name AS parent2_cat, catdescparent1.categories_Name AS parent1_cat, catdesccurrent.categories_Name AS current_cat, catdescparent4.categories_id AS parent4_id, catdescparent3.categories_id AS parent3_id, catdescparent2.categories_id AS parent2_id, catdescparent1.categories_id AS parent1_id, catdesccurrent.categories_id AS current_id FROM (categories , products prd, products_description AS prdsc, categories_description AS catdesccurrent, products_to_categories AS prdtocat) LEFT JOIN categories_description AS catdescparent1 on ( catdescparent1.categories_id = categories.parent_id AND catdescparent1.language_id = '1' ) LEFT JOIN categories AS cat2 on ( cat2.categories_id = categories.parent_id ) LEFT JOIN categories_description AS catdescparent2 on ( catdescparent2.categories_id = cat2.parent_id AND catdescparent2.language_id = '1' ) LEFT JOIN categories AS cat3 on ( cat3.categories_id = cat2.parent_id ) LEFT JOIN categories_description AS catdescparent3 on ( catdescparent3.categories_id = cat3.parent_id AND catdescparent3.language_id = '1' ) LEFT JOIN categories AS cat4 on ( cat4.categories_id = cat3.parent_id ) LEFT JOIN categories_description AS catdescparent4 on ( catdescparent4.categories_id = cat4.parent_id AND catdescparent4.language_id = '1' ) LEFT JOIN manufacturers AS manuf ON ( manuf.manufacturers_id = prd.manufacturers_id ) WHERE ( prd.products_id = prdsc.products_id AND prdsc.language_id = '1' ) AND prd.products_id = prdtocat.products_id AND prdtocat.categories_id = categories.categories_id AND ( catdesccurrent.categories_id = categories.categories_id AND catdesccurrent.language_id = '1' ) AND prdtocat.categories_id in () LIMIT 10000

 

[TEP STOP]

Link to comment
Share on other sites

  • 2 months later...

I needed the same thing so I added in the file before this line

$xml_file.="\t"."</Product>\n";

this line of code

$xml_file.="\t\t".<product_url>".'http://www.yoursite.com/product_info.php?products_id='.($product['id'])."</product_url>\n";

 

Remember to change the url in whatever is your site's url. :thumbsup:

 

You missed a quotation in the code. You get a error. Use this one and it will work great. Thank you for the info.

$xml_file.="\t\t" . "<product_url>".'http://www.yoursite.com/product_info.php?products_id='.($product['id'])."</product_url>\n";

Edited by jsayers73
Link to comment
Share on other sites

  • 5 months later...

Hi,

 

will this contrib allow export of orders to xml??

 

I have a supplier that only accepts xml orders via ftp as their system is fully automated, so i need to be able to find a contrib that can do this.

 

any help offered is appeciated

 

thanks

Link to comment
Share on other sites

  • 3 months later...
  • 10 months later...

I'm making progress

 

next problem are prices in XML without tax.

How to change xml_export to show prices with 20% tax ?

 

Tnx

 

 

 

To change te price to show including tax change the following:

 

$xml_file.="\t\t" . "<Product_Price>".number_format($product['price'],2,'.','')."</Product_Price>\n";

 

to:

$xml_file.="\t\t" . "<Product_Price>".number_format($product['price']*1.19,2,'.','')."</Product_Price>\n";

 

Where *1.19 is the tax (Dutch 19%) It multiplies the product price by 1.19

 

That's all

Edited by wervelweb
Link to comment
Share on other sites

  • 4 months later...

I have this installed on my site and it works fine. The .xml file goes into the export folder. My question is: Will the script delete previous export.xml files in the folder. I want to setup a cron job to make the file run every day but there can only be one file in the folder at any given time.

Link to comment
Share on other sites

HI, I have this contribution working fine. I have it installed on oscommerce 2.3 but I am having a problem with the images. I can only make it display one image. How do I make it pull images from table_product_images? Any help would be greatly appreciated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...