You are here:  » Pre Purchase Question...


Pre Purchase Question...

Submitted by cbh on Tue, 2006-08-15 19:26 in

Hi all!

Hope you can answer a query I have..

Can you select certain model numbers from xml feeds and only put those into the script?

ie..

ABC123
DEF123
GHI123
JKL123
MNO123

I only want

DEF123
JKL123

to go into the script..

Is this at all possible?!

Also has anyone got any examples of sites you have created using this script? Just wanting to see how customisable it really is!

Thanks,

Steve

Submitted by henk on Tue, 2006-08-15 19:44

here is a link in the forum to show of the sites: Link !

And for the other q. there is David for :)

HEnk

Submitted by support on Wed, 2006-08-16 05:09

Thanks, Henk :)

Hi Steve,

As it stands there is no selective import facility; however it would be straight forward to add a new filter based on the existing "Drop Record" filter to make the script do this.

Provided that the field that you register as the product name contains just the model number you could add the following code to includes/filter.php to give you a new filter called "Selective Import"....

<?php
  
/*************************************************/
  /* selectiveImport                               */
  /*************************************************/
  
$filter_names["selectiveImport"] = "Selective Import";
  function 
filter_selectiveImportConfigure($filter_data)
  {
    print 
"Drop record if field does not match: (separate entries with a comma)<br />";
    print 
"<input type='text' size='40' name='text' value='".widget_safe($filter_data["text"])."' />";
    
widget_errorGet("text");
  }
  function 
filter_selectiveImportValidate($filter_data)
  {
  }
  function 
filter_selectiveImportExec($filter_data,$text)
  {
    global 
$filter_dropRecordFlag;
    if(
$filter_dropRecordFlag)
    {
      return 
$text;
    }
    
$filter_dropRecordFlag = (strpos($text,$filter_data["text"]) === FALSE);
    return 
$text;
  }
?>

To use this filter based on your example, register your feed as normal, but then before importing, create a new Selective Import filter against the Product Name field. In the text box on the filter configuration page, enter:

"DEF123,JKL123" (without the quotes)

If you actually need to combine the model number with a different field to generate the Product Name, simply register the model number field as the Product Name field, and then add a Text Before filter after the Selective Import filter to prepend the model numbers that do make it into the database with the values from any other field.

So, for example, if you had registered the field "MODEL" as the Product Name but the actual product name was in a field called "PRODUCTNAME", you could register a Text Before field containing the following:

"%PRODUCTNAME% " (without the quotes, note the space on the end)

Hope this helps!
Cheers,
David.

Submitted by Paul1107 on Sat, 2008-12-13 16:38

Hi David,

found this thread, as i'm trying to do a smimilar thing as my niche is quite narrow and have to filter out most of the other products within any feed

However If I look at Marks and Spencer for example the categories are within Numbers, and it is at the beginning of those numbers which differentiates the product, so for example "Parent_T422015" is one specfic product, to get the category I need the T422 part of it.

I have used the suggestion in this thread but It hasn't identified a partial code so it hasn't imported anything.

I appreciate any help

Thanks

Paul

Submitted by support on Sun, 2008-12-14 12:27

Hi Paul,

I would suggest using the "Drop Record If Not RegExp" which is in the distribution; but if doesn't appear in your filter list you can find the code in this thread. Then, you could use a filter text value something like:

(T422|T423|T424)

...which would import only products with those codes as part of the field against which you added the filter...

Hope this helps!

Cheers,
David.

Submitted by Paul1107 on Sun, 2008-12-14 19:14

Hi David,

tried that, and it has imputted 20 products or so each listed as a category: T421093,T421417,T421423... which is OK, however when clicked they have no information attached to them and the status line states "Product search results for category:T421093: (no results found)" where as all other categories have hyperlinks which when clicked show all products in category.

What have I done wrong this time?

Another question which is associated, If I de-register a feed, how can I get rid of all the categories associated with that old feed?

Thanks

Paul

Submitted by support on Sun, 2008-12-14 19:57

Hi Paul,

In reverse order; the Category A-Z is derived directly from the products table, so when you de-register a feed you would always remove any categories that are exclusively derived from that feed. If a category is still displayed that would indicate that another feed has at least one product in the same category.

Similarly, the categories that have no products is strange as again, the category list is derived directly from the product table; so a category for search for anything that appears on the Category A-Z should return results.

I just had a look at the site in your previous email and don't see any categories with this sort of name, so it may be a different URL - if you could email me the link i'll take a look and try and work out what's going on!

Cheers,
David.