You are here:  » Comparison empty SKU

Support Forum



Comparison empty SKU

Submitted by marco on Mon, 2008-09-29 12:21 in

Hello,

I have implemented the SKU mod (node775).

The price comparison works ok when a SKU is provided.

But for the products with no SKU it just goes straight to the cheapest product. The name of that product is completele different, so i think the comparison is now made on the emty SKU field?

Can you give me a hand with this one?

Regards,
Marco.

Submitted by support on Mon, 2008-09-29 15:32

Hello Marco,

Just so I can be completely sure what code you're using, could you email me your search.php and products.php and i'll take a look for you...

Cheers,
David.

Submitted by marco on Tue, 2008-09-30 11:05

Hi David,

The products.php file you send works great.
Thanks a lot!

Marco.

Submitted by daem0n on Thu, 2009-05-21 08:28

Hi David,

Quick question on this. I believe I have the same modification as Marco on this but I noticed a couple of my feeds have inserted blank sku's of " " (10 spaces) instead of just blank. How can I match these characters to exclude them from the search. My current code looks like:

if ($rows[0]["sku"] && $rows[0]["sku"] !== "000000000000" && $rows[0]["sku"] !== " ")

I tried adding that last part but it doesn't seem to work. How do you match "blank" characters in a MySQL field?...

Thanks! -Joe

Submitted by support on Thu, 2009-05-21 08:31

Hi Joe,

I'd do it by stripping out spaces from the SKU field before the test, for example:

$rows[0]["sku"] = str_replace(" ","",$rows[0]["sku"]);
if ($rows[0]["sku"] && $rows[0]["sku"] !== "000000000000")

Cheers,
David.

Submitted by daem0n on Thu, 2009-05-21 08:40

Thanks as always David, your support is amazing! I don't know how long it'd take to figure this stuff out without you?! (too long!) :S

-Joe