Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Exclude Category in Google Base Feed?


Rachael w.

Recommended Posts

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!

Link to comment
Share on other sites

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 by theantiquestore
Link to comment
Share on other sites

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.

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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

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

Link to comment
Share on other sites

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);
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...