Jump to content
gottaloveit

Automatically send data feed to Froogle

Recommended Posts

Hi,

Managed to customise it and its been running sweetly.

However, I currently have the MPN set to be filled with the Model number.

I have since created an MPN field and filled it on SOME MPN's of my 1000+ products by an putting extra field in the product edit page in admin.

 

What I need to do next is to change the code so it still fills MPN with Model, EXCEPT if the MPN field is not empty, in  which case it loads the MPN. (maybe an option for the next version?)

 

Thanks for all the work Jack, I use a  few of your addons.

Share this post


Link to post
Share on other sites

Google won't accept the model for the MPN unless it is a recognized MPN or your products are not manufactured by a recognized manufacturer. But if you still want to do this, I would add another line to load in the second field and then use one or the other based on if the MPN is empty. 

Share this post


Link to post
Share on other sites

Hello

 

I use Custom labels 0, 1 , 2 etc to control in adwords through the feed

 

My question is when a product is in more than one category 

 

 

products_to_categories.categories_id 
and
categories.parent_id
 
but it seems that if its in more than one category only the one of either is listed in the feed
 
can you suggest a way around this
 
I was thinking combining parent and cat ID but that does not work
 
possibly thinking about using cat name instead but if it changes that might cause issues and not sure if the custom labels only accept numbers or a restriction on  digits
 
is there another way round this
 
regards
 
 
david

David

Share this post


Link to post
Share on other sites

To partially answer my own question, 

 

yes you can use the category name, but that does not help, as the product is in more than one category so it has more than one category name

 

so back to the drawing board


David

Share this post


Link to post
Share on other sites

If you are referring to a duplicate product, the code will handle that already. But if you are referring to a linked product, there's no way to do that. You can remove the line shown below and linked products will be listed. But they will all have the url of the actual product. There isn't anything in the code of the shop that tracks the location of linked products so there's no way to figure out the correct path. You could change the code in categories.php to track links but that is a big job for little gain, or so it seems to me.

if (isset($already_sent[$row->id])) continue; 

Share this post


Link to post
Share on other sites

I had to do some upgrades on my server, now using php 5.4. Not sure if this is the reason but my feed is not returning any products (0). The column headers are created but there are no products in the feed. I am not getting any errors either. Here is the page after running the script:

 

 

Feed contains 0 products.

File Completed: products.txt

Use the following for easier viewing from this page. It is still in development and not meant for anything other than viewing.
File Completed: products.csv

Connected to uploads.google.com, for user me
Uploaded feeds/product.txt to uploads.google.com as products.txt

 

Any help would be greatly appreciated. The file did work correctly prior to the php upgrade. 

Share this post


Link to post
Share on other sites

@@Rachael w. I'm not aware of any problems with it running under 5.4. But please be sure you have the latest version installed since older versions probably would have problems.

Share this post


Link to post
Share on other sites

I have the most recent code: GoogleBase V 3.5. The only difference I see is the mysqli. Whether I have it as mysql or mysqli it still doesn't produce products. 

Share this post


Link to post
Share on other sites

I seem to recall the code that detects the mysql engine didn't work for someone before. That could cause this. Please try the following. Find this line in the admin/googlefeeder.php file

$myfetch_mysql = ($use_mysqli ? mysqli_fetch_object : mysql_fetch_object);

and change it to

 $myfetch_mysql = mysqli_fetch_object;
 

If the script still fails, then change it to

 $myfetch_mysql = mysql_fetch_object;

If it still fails, I don't know what it might be, assuming nothing else has changed. If you host with me or are a previous client, please contact me via email and I will take a look.

Share this post


Link to post
Share on other sites

Great contribution! 

 

On googlefeeder.php I didn't find any option to add additional gtin codes for products with variants. For example when the product comes in multiple colours or sizes, and you have different unique product identifiers for each of these variants. How can I do that?

Edited by egutierrez

Share this post


Link to post
Share on other sites

The feed isn't setup to handle that. All of the variants (attributes) are listed on one line for that product so there is only one place for the GTIN. The code would have to be changed to lit each variant on a new line. And even then, your shop's code would have to be changed to allow the storing of a GTIN per attribute. This can all be done but would not be a simple change.

Share this post


Link to post
Share on other sites

I've just installed the contribution, using 2.3.4 BS Edge, and testing it via wampserver (offline before going online) and the feed grabs all the details, great, but for product description, it grabs the whole product info (which I've changed product_description to product_seo_description so it can get a smaller amount of text) and the data is separated by each comma.

EG. Let's say my product info/ seo decription reads, "This is the biggest, fastest, best, PC you'll ever have" - priced $2999

URL will have the product URL

Title will have the product name

Description will have "This is the biggest"

Price will have "fastest"

Image Link will have "best"

ID will have "PC you'll ever have"

Availability will have "2"

Brand will have "999"

etc

 

So you see that the text is split into each column due to the commas, even the price.

 

How can I correct this?

 

Thanks

Share this post


Link to post
Share on other sites

Something in the description is causing the problem. Create a new product, or edit an existing one, and reduce the description to half of the text, like "This is the biggest, fastest" and run the feed. If that product is correct, increase the text and try again. If not, reduce the text and try again. Eventually you'll find the cause.

Share this post


Link to post
Share on other sites

I got an email from Google merchant today about getting customer reviews, so I decided to do it.  I added this to template_bottom.php and you will need to have your merchant account from Google to make this work.  You also have to agree to terms.  My code also uses US so change to your country but this works as planned.

<?php
  if (basename($PHP_SELF) == 'checkout_success.php') {
    $dt = new DateTime(date(" Y-m-d"));
    $dt->modify("+10 days");
    $delivery_date = $dt->format("Y-m-d");
    $email_address_query = tep_db_query("select customers_email_address from customers where customers_id = '" . (int) $customer_id . "'");
    $email = tep_db_fetch_array($email_address_query);
    $email_address = $email['customers_email_address'];
?>

<!-- BEGIN GCR Opt-in Module Code -->
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>

<script>
  window.renderOptIn = function() {
    window.gapi.load('surveyoptin', function() {
      window.gapi.surveyoptin.render(
        {
          "merchant_id": Your merchant number,
          "order_id": "<?php echo $order_id ?>",
          "email": "<?php echo $email_address ?>",
          "delivery_country": "US",
          "estimated_delivery_date": "<?php echo $delivery_date ?>"
        });
     });
  }
</script>
<!-- END GCR Opt-in Module Code -->

<?php
  }
?>

From Google:

How to enable Google Customer Reviews

1)

Sign in to your Merchant Center account

2)

Select "Merchant Center programs" from the 3-dot-menu in the upper right-hand corner.

3)

Click "Get Started" in the Google Customer Reviews card and accept the Program Agreement.

4)

Add the survey opt-in code to your website.

5)

[Optional] Add the badge code to your site wherever you want. This will make the badge appear on your site and show customers that you're integrated with Google Customer Reviews (and what your seller rating is).

 

 


I'm not really a dog.

Share this post


Link to post
Share on other sites

I seem to recall the code that detects the mysql engine didn't work for someone before. That could cause this. Please try the following. Find this line in the admin/googlefeeder.php file

$myfetch_mysql = ($use_mysqli ? mysqli_fetch_object : mysql_fetch_object);

and change it to

 $myfetch_mysql = mysqli_fetch_object;
 

If the script still fails, then change it to

 $myfetch_mysql = mysql_fetch_object;

If it still fails, I don't know what it might be, assuming nothing else has changed. If you host with me or are a previous client, please contact me via email and I will take a look.

 

Thank you so much Jack! I apologize for returning so late to respond. Your code DID WORK (the first suggestion)! I appreciate your dedication. 

Share this post


Link to post
Share on other sites

I got an email from Google merchant today about getting customer reviews, so I decided to do it.  I added this to template_bottom.php and you will need to have your merchant account from Google to make this work.  You also have to agree to terms.  My code also uses US so change to your country but this works as planned.

<?php
  if (basename($PHP_SELF) == 'checkout_success.php') {
    $dt = new DateTime(date(" Y-m-d"));
    $dt->modify("+10 days");
    $delivery_date = $dt->format("Y-m-d");
    $email_address_query = tep_db_query("select customers_email_address from customers where customers_id = '" . (int) $customer_id . "'");
    $email = tep_db_fetch_array($email_address_query);
    $email_address = $email['customers_email_address'];
?>

<!-- BEGIN GCR Opt-in Module Code -->
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>

<script>
  window.renderOptIn = function() {
    window.gapi.load('surveyoptin', function() {
      window.gapi.surveyoptin.render(
        {
          "merchant_id": Your merchant number,
          "order_id": "<?php echo $order_id ?>",
          "email": "<?php echo $email_address ?>",
          "delivery_country": "US",
          "estimated_delivery_date": "<?php echo $delivery_date ?>"
        });
     });
  }
</script>
<!-- END GCR Opt-in Module Code -->

<?php
  }
?>

From Google:

How to enable Google Customer Reviews

1)

Sign in to your Merchant Center account

2)

Select "Merchant Center programs" from the 3-dot-menu in the upper right-hand corner.

3)

Click "Get Started" in the Google Customer Reviews card and accept the Program Agreement.

4)

Add the survey opt-in code to your website.

5)

[Optional] Add the badge code to your site wherever you want. This will make the badge appear on your site and show customers that you're integrated with Google Customer Reviews (and what your seller rating is).

 

Have you created a separate thread for this? I'm still working migrating to the most recent version of oscommerce and I have the old version with a footer.php called on the pages. I can't seem to get this to work right. I'm not getting errors, I'm just not seeing anything google on the page. 

 

Thank you for your help. Please respond with a link to your thread so we don't highjack the merchant feed thread. :)

Share this post


Link to post
Share on other sites

Google Merchant Center is no longer happy with my feeds.  Says the images are too small.

I assume they're referencing the photos from the images folder, the thumbnails that are sized as 75 X100 and the minimum size accepted is 100 x 100.

Is there any way to change where the images are being pulled from in the googlefeeder.php file?  Instead of being pulled from mysite.com/images I'd like them pulled from mysite.com/photos

The photos folder holds the same-named images in much bigger file sizes.

Thanks!

Share this post


Link to post
Share on other sites

Google may not allow a link not being used on the site but you can change the line below and it may work.

$imageURL = 'http://' . DOMAIN_NAME . '/images/';

 

Share this post


Link to post
Share on other sites

I changed the word 'images' to 'photos' and ran the Googlefeeder.  It worked perfectly!

The merchant feed is now showing items pending - no more image errors.  Thanks!

Share this post


Link to post
Share on other sites

Hi @Jack_mcs,

I have a problem with the prices (with taxes from the $price_w_tax):

If the result is e.g 69.899 (three numbers after the dot) this is seen by google as EUR 69.899,00 which is a bit too much.

If the result ist eg. 27.8955 (four number after the dot) is used correctly : EUR 27,90. Any clues?

Another thing would be nice to have: Base price functionality as it is required for certain products in the EU. I know this requires at least two new columns in products and accordingly changes to admin/categories.

Best regards

Christoph

 

Share this post


Link to post
Share on other sites

Try changing this line

      if (CONVERT_CURRENCY) {
          $row->price = preg_replace("/[^.0-9]/", "", $row->price);

to

      if (CONVERT_CURRENCY) {
          $row->price = round($row->price,2);
          $row->price = preg_replace("/[^.0-9]/", "", $row->price);

I haven't tested the above but it might help. It also assume you are using the convert currency option.

Share this post


Link to post
Share on other sites

@Jack_mcs No sorry I'm just into Euros..

Did this for now from:

$row->price = $price_w_tax;

to:

$row->price = round($price_w_tax,2);

puts out nor more then two digits after dot, seems to work, any caveats with this?

Best regards

Christoph

Share this post


Link to post
Share on other sites

The change is just rounding the number to two digits. There shouldn't be any problems caused by it.

Share this post


Link to post
Share on other sites

@Jack_mcs

Regarding the price with tax I ended up with this:

 $row->price = $currencies->display_raw($row->price_no_tax, tep_get_tax_rate((int)$row->tax_id));

Another thing I had a problem with was

if(OPTIONS_ENABLED_INCLUDE_TAX == 1 || OPTIONS_ENABLED_INCLUDE_TAX == 3) $output .= "\ttax";

As I have OPTIONS_ENABLED_INCLUDE_TAX == 3 the heading would a add a tab stop with title tax but the feed  would not have the have tax rate (I could not find anything which would put that there in the code) nor the tab stop in it, which produced errors at merchants.google missing that tab stop.

So I changed to

if(OPTIONS_ENABLED_INCLUDE_TAX == 1) $output .= "\ttax";

Best regards

Christoph

Share this post


Link to post
Share on other sites

That is due to mistakes in the file. There isn't an option 3. Please try replacing the two instances of

OPTIONS_ENABLED_INCLUDE_TAX == 3

with

OPTIONS_ENABLED_INCLUDE_TAX == 2

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×