[PAID] Google Merchant Static Feed

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [PAID] Google Merchant Static Feed

Post by Martin »

Right... first things first.. free shipping is now covered by this:

Open: /includes/classes/class.froogle.php (Amended!)

Find:

Code: Select all

				//TODO Get Shipping information
				if(in_array($countryiso, array('AU','US','GB','DE','FR'))) {


Replace with:

Code: Select all

				// Free Shipping?
				if(isset($row['prodfreeshipping']) && $row['prodfreeshipping'] == 1){
					$entry[] = "<g:shipping>{$this->Lend}\t\t<g:price><![CDATA[0]]></g:price>{$this->Lend}\t</g:shipping>";
				}
				// Fixed Shipping?
				elseif(array_key_exists('prodfixedshippingcost', $row) && $row['prodfixedshippingcost'] > 0) {
					$entry[] = "<g:shipping>{$this->Lend}\t\t<g:price><![CDATA[".$row['prodfixedshippingcost']."]></g:price>{$this->Lend}\t</g:shipping>";
				}
				// Not free shipping so get a quote if we're in a relevant country.
				elseif(in_array($countryiso, array('AU','US','GB','DE','FR'))) {
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [PAID] Google Merchant Static Feed

Post by Martin »

levinthan9 wrote:Thanks for your quick response.

Update as you said, and now I get this error
I'm an idiot... excuse me while I unwind my head out of my backside and sort out a basic coding fubar... brb...
levinthan9
Posts: 7
Joined: Tue Mar 20, 2012 1:47 am
Location: asd

Re: [PAID] Google Merchant Static Feed

Post by levinthan9 »

Updated your free shipping fix. Now still getting the same error

Code: Select all

feed (C:/wamp/www/xxxxxxxxxxx/cache/US_froogle-export.xml) not located in ISC Cache directory. Probable hack attempted
Aborting

And also see this in ISC error log

Code: Select all

PHP N/A preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Compilation failed: missing ) at offset 36 20th Mar 2012 @ 4:27 AM   preg_match() [function.preg-match]: Compilation failed: missing ) at offset 36 in C:\wamp\www\xxxxxxxxxxx\includes\classes\class.froogle.php at 325
File 	Line 	Function
[PHP] 	  	ISC_LOG->HandlePHPErrors
C:\wamp\www\xxxxxxxxxxx\includes\classes\class.froogle.php 	325 	preg_match
C:\wamp\www\xxxxxxxxxxx\includes\classes\class.froogle.php 	404 	ISC_FROOGLE->checkFeedPerms
C:\wamp\www\xxxxxxxxxxx\includes\classes\class.froogle.php 	230 	ISC_FROOGLE->ExportFroogle
C:\wamp\www\xxxxxxxxxxx\froogle.php 	17 	ISC_FROOGLE->HandlePage
Also this one in apache error log

Code: Select all

ue Mar 20 05:27:08 2012] [error] [client 127.0.0.1] PHP Stack trace:
[Tue Mar 20 05:27:08 2012] [error] [client 127.0.0.1] PHP   1. {main}() C:\\wamp\\www\\xxxxxxxxxxx\\froogle.php:0
[Tue Mar 20 05:27:08 2012] [error] [client 127.0.0.1] PHP   2. ISC_FROOGLE->HandlePage() C:\\wamp\\www\\xxxxxxxxxxx\\froogle.php:17
[Tue Mar 20 05:27:08 2012] [error] [client 127.0.0.1] PHP   3. ISC_FROOGLE->ExportFroogle() C:\\wamp\\www\\xxxxxxxxxxx\\includes\\classes\\class.froogle.php:230
[Tue Mar 20 05:27:08 2012] [error] [client 127.0.0.1] PHP   4. ISC_FROOGLE->checkFeedPerms() C:\\wamp\\www\\xxxxxxxxxxx\\includes\\classes\\class.froogle.php:404
[Tue Mar 20 05:27:08 2012] [error] [client 127.0.0.1] PHP   5. preg_match() C:\\wamp\\www\\xxxxxxxxxxx\\includes\\classes\\class.froogle.php:325
[Tue Mar 20 05:27:09 2012] [error] [client 127.0.0.1] PHP Warning:  preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Compilation failed: missing ) at offset 36 in C:\\wamp\\www\\xxxxxxxxxxx\\includes\\classes\\class.froogle.php on line 325
Hope it would helpful.
I have TeamViewer open, you can connect anytime if you want.
I feel like so far away to the goal :(
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [PAID] Google Merchant Static Feed

Post by Martin »

The free shipping bug was not related to your problem Lev'...

The issue we've got is with the windows path and, initially at least, the way the system checks if the feed is being generated in the cache directory or not... windows paths use the escape directory which is just stunningly unhelpful when it comes to regex.
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [PAID] Google Merchant Static Feed

Post by Martin »

There was a bug with my earlier code above...


So if you've made the adjustment before it was marked as " (Amended)" then please re-edit the file as follows:


Open: /includes/classes/class.froogle.php

Find:

Code: Select all

				// Free Shipping?
				if(isset($row['prodfreeshipping']) && $row['prodfreeshipping'] != 1){
					$entry[] = "<g:shipping><g:price><![CDATA[0]]></g:price></g:shipping>\n</entry>";
				}
				// Not free shipping so get a quote if we're in a relevant country.
				elseif(in_array($countryiso, array('AU','US','GB','DE','FR'))) {
Replace with:

Code: Select all

				// Free Shipping?
				if(isset($row['prodfreeshipping']) && $row['prodfreeshipping'] == 1){
					$entry[] = "<g:shipping>{$this->Lend}\t\t<g:price><![CDATA[0]]></g:price>{$this->Lend}\t</g:shipping>";
				}
				// Fixed Shipping?
				elseif(array_key_exists('prodfixedshippingcost', $row) && $row['prodfixedshippingcost'] > 0) {
					$entry[] = "<g:shipping>{$this->Lend}\t\t<g:price><![CDATA[".$row['prodfixedshippingcost']."]></g:price>{$this->Lend}\t</g:shipping>";
				}
				// Not free shipping so get a quote if we're in a relevant country.
				elseif(in_array($countryiso, array('AU','US','GB','DE','FR'))) {

The bug was that everything was marked as free shipping... but this new nugget fixes that as well as checking for the fixed shipping value as well...
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [PAID] Google Merchant Static Feed

Post by Martin »

Ok... 1.4.8 has been released...

It's up on the Snailsolutions store
  • Version 1.4.8 : Revision 475-476
    • FIXED: Resolved empty feeds using 6.1.7 onwards
    • ADDED: Free shipping and Fixed shipping product settings now interpreted correctly
    • ADDED: More verbose information about products skipped and why
    • FIXED: Resolved path check for Windows hosted ISC stores
  • Version 1.4.7 : Revision 469-470
    • UPDATED: Resolved incompatibility with 6.1.7 onwards
    • UPDATED: 6.1.6 version of shoppingcomparison.categorybox.tpl included
    • ADDED: Now pulls data from 6.1.7 google product search table if available
    • UPDATED: US Google merchant taxonomy updated
    • PENDING: Does NOT yet pull google product type from 6.1.7 so those versions onwards need to set the google product as a product comparison AND set something for google product search tab to ensure the product saves.
levinthan9
Posts: 7
Joined: Tue Mar 20, 2012 1:47 am
Location: asd

Re: [PAID] Google Merchant Static Feed

Post by levinthan9 »

Hi Martin.

Thank you for your work. The script works, and I'm exporting to US_froogle-export.xml
The problem is it loads SUPER fast at the beginning, like 100 products per sec. but then slower and slower. And right now it seems like taking 2 seconds for a product.
And I have 220k products, so it would be 440,000 seconds / 3600 = 122 hours ( 5 days) :shock:
you have any idea about this?
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [PAID] Google Merchant Static Feed

Post by Martin »

levinthan9 wrote:Thank you for your work. The script works, and I'm exporting to US_froogle-export.xml
Glad we fixed most of it...
The problem is it loads SUPER fast at the beginning, like 100 products per sec. but then slower and slower. And right now it seems like taking 2 seconds for a product.
And I have 220k products, so it would be 440,000 seconds / 3600 = 122 hours ( 5 days) :shock:
you have any idea about this?
I suspect it's an operating system issue in that Windows is probably loading the whole file into memory and appending the new data to the end, thus filling the file and adding yet more to memory...

Be useful to know how big the feed file size is now as an indicator...
levinthan9
Posts: 7
Joined: Tue Mar 20, 2012 1:47 am
Location: asd

Re: [PAID] Google Merchant Static Feed

Post by levinthan9 »

Thanks for kind reply. Do you think it is because of apache / script time/memory limitation? If so, do you know where I can edit my apache to break that limit? I have 32GB memory with 6 cores cpu, so I don't think I will have any problem with high load apache/mysql.
levinthan9
Posts: 7
Joined: Tue Mar 20, 2012 1:47 am
Location: asd

Re: [PAID] Google Merchant Static Feed

Post by levinthan9 »

Got a solution. Refresh it every 4-5 mins seems the best way to boost it :lol:
Post Reply