X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Froogle Google (https://forum.x-cart.com/showthread.php?t=2286)

kpayne 07-29-2003 03:36 AM

Ah, in that case, I've gotten 9 clicks. I'm sure like 5 of those were in-house clicks.

jgkiefer 07-29-2003 05:04 AM

Quote:

For those that want to actually see what is being generated, you can modify the php above like this...

# $fp = tmpfile();

$fp = fopen("./froogle_temp.txt", "w+");

How would I set it to download the froogle feed to a directory on my website server? That way I could set a cron tab to do this - give it a quick check and submit it myself. I like to check what is being auto-generated before submitting.

HairGuy 07-29-2003 07:30 AM

How to test it
 
To test the froogle_update.php script, just set the following variables (in the config.php file) to point to your FTP server:

$froogle_host = your FTP host
$froogle_username = your FTP username
$froogle_password = your FTP password

If you do this, it will send the export file to your FTP server (instead of Google's).

jgkiefer 08-04-2003 05:20 AM

It is putting in an extra slash / following the .com - example
Code:

http://officeemergencysupplies.com//customer/product.php?productid=16134
Where can I remove the extra / in the froogle code?

HairGuy 08-05-2003 09:56 AM

Check the setting of the $xcart_web_dir variable in config.php. It is probably set to '/'.

The product URL uses $http_location to build the link, so check to see if it has a trailing slash. If it does, you could use preg_replace() to remove it.
Try this:

Code:

$product_url = preg_replace('/\/$/', '', $http_location).'/customer/product.php?productid='.$products[$key][productid].$partner_track;

You may also need to do the same thing to $image_url

If the above does not work, then you may be using a version of X-Cart that I am not familiar with.

jgkiefer 08-05-2003 12:09 PM

Thank you, worked like a charm. :)

successful 08-05-2003 01:55 PM

Quote:

Originally Posted by davesphoto
I think I got it!
This does not print any extra lines. It also removes any extra tabs created by multiple carrage returns in the description (I am not sure why this happened with the old code but another |strip did the trick). Anyways, this is what I am using now for product_export.tpl:

Code:

{strip}
product_url{$delimiter}
name{$delimiter}
description{$delimiter}
price{$delimiter}
image_url{$delimiter}
category{$delimiter}
offer_id{$delimiter}
shipping{$line}
{section name=prod_num loop=$products}
http://www.davesphotoemporium.com/store/customer/product.php?productid={$products[prod_num].productid|replace:"\"":""}&cat={$products[prod_num].categoryid|replace:"\"":""}&partner=froogle{$delimiter}
{$products[prod_num].product|replace:"\"":""}{$delimiter}
{$products[prod_num].descr|replace:"\r":" "|replace:"\n":" "|replace:"\t":" "|replace:"\"":""|replace:",":","|strip_tags |strip}{$delimiter}
{$products[prod_num].price|replace:"\"":""}{$delimiter}
http://www.davesphotoemporium.com/store/image.php?productid={$products[prod_num].productid|replace:"\"":""}{$delimiter}
{$products[prod_num].category|replace:"/":" > "|replace:"\"":""}{$delimiter}
{$products[prod_num].productcode|replace:"\"":""}{$delimiter}
0.00{$line}
{/section}
{/strip}


Now be carefull! This tpl seems very sensitive to extra spaces or lines in the code, so don't leave any! Also notice I am using the short description, not the full one (I dont use it for display on the website so now it is the "froogle" description).

Also please note: You must define and assign the variable $line as the line delimiter in the export.php.

Put this at the top:
Code:

$line = "\n";

And this right after $smarty->assign("delimiter", $delimiter);:
Code:

$smarty->assign("line", $line);


This should export data ready for upload to froogle without modification (at least it does for me :wink: ).

I am not a programmer and do not know all the etiquette so I hope I am not stepping on any toes posting this code seeing as how some of the lines are unchanged from the code posted earlier in the discussion. The idea is quite different though. Anyway, I make no claim to the code; use it for anything you want! Hopefully it helps!



Hmmm.....I tried this and Google responded as follows:

Thank you for submitting your data feed. We have reviewed your feed and
need you to make some changes so that we can successfully process your
feed.

Please remove the first line of "$line = "\n";" from your data feed.
Please also separate the header and each product from other products by
using a line break. For example, after the shipping field for each
product, there should be a line break to separate it from the next
product.

After you have made this change, please upload a new version of your feed
with the same filename as before, and email us so that we can check the
new version.



Any suggestions ?

jgkiefer 08-05-2003 04:56 PM

Quote:

Any suggestions ?

Yes use the froogle_update.php mod from HairGuy on the previous page. It is the best!!! I think x-cart developers should include it in the x-cart package.

cloud9 08-05-2003 06:47 PM

Yep, HairGuy's script rocks. The only things I had to tweak to get my feed accepted by Froogle was to remove the offer_id (I didn't have any), and modify the script to not add an image link if I didn't actually have an image for a product.

jgkiefer 08-05-2003 07:40 PM

Quote:

Originally Posted by cloud9
modify the script to not add an image link if I didn't actually have an image for a product.


Oop's I forgot about that. How did you modify the code to not add an image link for products with no images?

What's an offer_id?


All times are GMT -8. The time now is 11:13 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.