Rachael w. Posted February 9, 2013 Posted February 9, 2013 Is it possible to exclude a category from a google base feed? Has anyone done it? Here is where I think the code could go, but I dont know what that code could be: while( $row = mysql_fetch_object( $result ) ) { if (OPTIONS_IGNORE_PRODUCT_ZERO > 0 && $row->quantity < 1) continue; //skip products with 0 qty if (isset($already_sent[$row->id])) continue; // if we've sent this one, skip the rest of the while loop it should be something like "if category = 12 then ignore" but I dont know how to code it. Thanks! Quote
Rachael w. Posted February 16, 2013 Author Posted February 16, 2013 (edited) ok, no help...I'll just have to figure this one out on my own. Here's what I've done so far: define('OPTIONS_IGNORE_CATEGORY', 1); // 1 = ignore category noted on line 342 Line 342 has this: while( $row = mysql_fetch_object( $result ) ) { if (OPTIONS_IGNORE_PRODUCT_ZERO > 0 && $row->quantity < 1) continue; //skip products with 0 qty if (OPTIONS_IGNORE_CATEGORY == 1 && parentCatID-> 897) continue; //skip products in this category if (isset($already_sent[$row->id])) continue; // if we've sent this one, skip the rest of the while loop what do I do????? Edited February 16, 2013 by theantiquestore Quote
Rachael w. Posted February 16, 2013 Author Posted February 16, 2013 last post leads to this: Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/xxxx/public_html/froogle.php on line 342 Quote
Rachael w. Posted February 16, 2013 Author Posted February 16, 2013 changed line 342 to this: if (OPTIONS_IGNORE_CATEGORY == 1 && $row->parentCatID == 897) continue; //skip products with 0 qty and it didnt work...trying something else. Quote
Rachael w. Posted February 16, 2013 Author Posted February 16, 2013 now I have this and it is still not working, what am I doing wrong? if (OPTIONS_IGNORE_CATEGORY > 0 && $row->catParentID == 897) continue; //skip products in this category Quote
Jack_mcs Posted February 17, 2013 Posted February 17, 2013 Try changing this AND categories_description.language_id to AND categories.categories_id <> XX and categories_description.language_id where XX is the category ID. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Rachael w. Posted February 17, 2013 Author Posted February 17, 2013 Try changing this AND categories_description.language_id to AND categories.categories_id <> XX and categories_description.language_id where XX is the category ID. Thank you, I tried it. It worked to take the category name out but I need to exclude all the products under that main category (and sub cats). Quote
Rachael w. Posted February 17, 2013 Author Posted February 17, 2013 if ($row->categories.categories_id == '897') continue; doesnt work either... :( Quote
Rachael w. Posted February 17, 2013 Author Posted February 17, 2013 Maybe I could put the exclude products in the main category under this??? if(OPTIONS_ENABLED_PRODUCT_TYPE == 1) $output .= "\t" . ((OPTIONS_PRODUCT_TYPE == strtolower('full')) ? $catIndex[$row->prodCatID] : $row->catName); Quote
Jack_mcs Posted February 17, 2013 Posted February 17, 2013 Oh, I didn't realize that is what you wanted. You can't do it as the code is now. You will need to add a function that checks if each product is in a category you want to exclude. All of the data you need is present, the code just has to cycle through it. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Rachael w. Posted February 17, 2013 Author Posted February 17, 2013 I'll see what my little brain can come up with, the reason I need to exclude a category is that google is denying my entire feed based on one category "tobacciana" :( Quote
Rachael w. Posted February 17, 2013 Author Posted February 17, 2013 here is a function that already exists, I thought if I used $catParID somewhere as a statement to ignore the parent id of 897 it would work, I guess I don't have a clue what I'm doing. function findCat($curID, $catTempPar, $catTempDes, $catIndex) { if( (isset($catTempPar[$curID])) && ($catTempPar[$curID] != 0) ) { if(isset($catIndex[$catTempPar[$curID]])) { $temp=$catIndex[$catTempPar[$curID]]; } else { $catIndex = findCat($catTempPar[$curID], $catTempPar, $catTempDes, $catIndex); $temp = $catIndex[$catTempPar[$curID]]; } } if( (isset($catTempPar[$curID])) && (isset($catTempDes[$curID])) && ($catTempPar[$curID] == 0) ) { $catIndex[$curID] = $catTempDes[$curID]; } else { $catIndex[$curID] = $temp . ", " . $catTempDes[$curID]; } return $catIndex; } $catIndex = array(); $catTempDes = array(); $catTempPar = array(); $processCat = mysql_query( $catInfo )or die( $FunctionName . ": SQL error " . mysql_error() . "| catInfo = " . htmlentities($catInfo) ); while ( $catRow = mysql_fetch_object( $processCat ) ) { $catKey = $catRow->curCatID; $catName = $catRow->catName; $catParID = $catRow->parentCatID; if($catName != "") { $catTempDes[$catKey]=$catName; $catTempPar[$catKey]=$catParID; } } foreach($catTempDes as $curID=>$des) { //don't need the $des $catIndex = findCat($curID, $catTempPar, $catTempDes, $catIndex); } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.