You are here:  » Questions about Automatic Product Mapping by UID


Questions about Automatic Product Mapping by UID

Submitted by desanta on Fri, 2021-06-04 07:54 in

Hey,

I have a couple questions about Automatic Product Mapping by UID.

1) Most of my products have the same name. After I register a feed PT maps all of them by identical names. So I added a unique field - "UID" and tried Automatic Product Mapping by UID but still get the same result.

2) Can I set up Automatic Mapping based on several fields? For example if some products have the same brand, name and category then PT should map them.

3) Each time I update the feed files, PT cleans all existing products and the old pages with brands, categories, etc, that are no longer exist in the new feed will respond with 404 code. Is there a possibility to keep them alive?
I was thinking of some "extra" feed that contains all of the fields I need. And set up PT to show some message like "There are no products in stock" if there is no more feed but "extra" one.

Submitted by support on Fri, 2021-06-04 13:03

Hi,

What I would suggest trying first is to combine category and brand with the product name using filters and see how the default comparison works for you in that case. To try this, from the /admin/ home page click Global Filters and add a new Text After filter to the Product Name field. In the text box on the configuration page for the new filter, use:

" {category} {brand}"

- without the quotes, but note the leading SPACE so that there is separation between the product name and the category.

Re-import all feeds and products should only be compared when name + category + brand are the same (as that is what is forming the new name).

Regarding products no longer in the feed but you would like to keep them alive; you can do this with a small change to the Insert/Update modification described in this thread.

That mod is intended to keep products that haven't actually been deleted in the same database record (preserving the id value) but what you can do is _not_ apply the last modification to includes/admin.pgp which is this replacement at line 734:

    $sql = "DELETE FROM `".$config_databaseTablePrefix.$table."` WHERE deleteme='1'";
    database_queryModify($sql,$insertId);
    $sql = "SELECT COUNT(*) AS productCount FROM `".$config_databaseTablePrefix.$table."` WHERE filename='".database_safe($admin_importFeed["filename"])."'";

Leaving that as the original code will skip the delete step, leaving the product in the database but with `deleteme` = 1 in the product record so you can use this to show "Out of stock" in the price comparison table. To do this in place of the visit store button, edit html/prices.php and look for the following code at line 67:

            <td class='pt_pr_visit'><a class='button tiny radius success' href='<?php print tapestry_buyURL($product); ?>'><?php print translate("Visit Store"); ?></a></td>

...and REPLACE wtih:

            <?php if ($product["deleteme"]): ?>
            <td class='pt_pr_visit'><small>Out of stock</small></td>
            <?php else: ?>
            <td class='pt_pr_visit'><a class='button tiny radius success' href='<?php print tapestry_buyURL($product); ?>'><?php print translate("Visit Store"); ?></a></td>
            <?php endif; ?>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com