You are here:  » Feed Assisted Voucher Code Management is here!


Feed Assisted Voucher Code Management is here!

Submitted by support on Thu, 2013-02-21 12:29 in

Hi everyone,

The new voucher and discount code feed assisted voucher code management tool is now included in the latest distribution (13/03A) and available to download as an upgrade package for all other users (see below).

The Voucher Codes tool now shows a list of feeds present in the /voucherfeeds/ folder of your installation (configurable - for example this can be changed to /feeds/ for use with the Automation Tool) as can been seen in the following screenshot: (click to enlarge)

Voucher code feed registration will be instantly recognisable to all Price Tapestry users, with format auto-detection followed by field mapping (merchant, code, start date, end date, description) on step 2 as shown below:

After a final registration step in which merchant names in the feed are mapped to the merchant names in use on your site the codes are then listed ready to be added as required:

In addition to the voucher code edit / add page now including a helper tool, from which you can look up product, category and brand names associated with the voucher being added, when adding a feed in this way the raw feed data is also displayed:

Based on the field mapping entered when registering the feed, the script will attempt to parse the description, valid from and valid to date fields in order to pre-populate the form. Use the raw data display to verify that values such as discount value and type have been recognised correctly and finally click Save to add the code to your site.

The modification is running on the demo site www.webpricecheck.co.uk/admin/ (username: demo, password: demo) if you want to take a closer look.

12/10B Users

Download AdminUpgrade_From_1210B.zip. Archive is relative to the Price Tapestry installation folder, and contains the /voucherfeeds/ folder (check that your unzip program extracts this as it is empty). Unzip, and then upload all files to your site. After uploading, browse to

/admin/voucher_codes_dbmod.php

...to add the new `voucherfeeds` table to your database and you're ready to go! The archive also contains a modified /admin/database_tool.php including the support for voucher and discount code feeds.

Any comments and feedback very much appreciated - I'm aware of the wide variety of feeds out there so in particular, if you are trying to use a feed for which the description contains a clear discount value / type etc. but it is not being recognised, if you would post a copy of the description text I can process it against the regular expressions used in the parsing.

Enjoy!

David
--
PriceTapestry.com

Submitted by philstone on Thu, 2013-02-21 21:30

Hi David

This is a great script advancement!!! as always!!,

three recommendations/things i think would make this perfect

1. in this instance "50% off the Never Loses Suction Lift Away Bagless Upright Vacuum Cleaner (models 73411 and 73410)" is it possible to have one discount code feed entry covering two or more keyword matches?, in this instance: 73410 & 73411 .... can you have more than one keyword?

2. is it possible to extend the match to more fields than name, brand and category? ie description, model etc

3. can the description text auto load in the Discount Text field?

but this is a massive step forward David with the voucher element of PT!!! Love it!

regards

Phil Stone
www.buy24-7.net

Submitted by support on Fri, 2013-02-22 11:38

Thanks for your comments, Phil!

1) and 2) I will implement - the Match Field drop-down can be populated by Product Name, Category, Brand and any additional custom fields from $config_fieldSet. Multiple matches can be implemented using comma separation in the match text field.

A number of people have asked about 3) so I'm going to review how discount text can be utilised where a standard discount type applies. As it stands, the discount text is rendered into the page in the price column which isn't really appropriate for the long descriptive text fields often contained in the voucher description so I'll look into this!

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Mon, 2013-02-25 14:20

Hi David

Just spotted another small issue, here is an example of some voucher codes from the same merchant

Merchant Name SAVE50 Add Edit Delete Save £50 off the retail price of the LG 50PA650T 3D Television
Merchant Name SAVE50 Add Edit Delete Save £50 off the retail price of the LG 50PM970T 3D Television
Merchant Name SAVE15 Add Edit Delete Save £15 off the retail price of the Toshiba 40TL963
Merchant Name SAVE50 Add Edit Delete Save £50 off the retail price of the LG 42PM470T 3D Television
Merchant Name SAVE50 Add Edit Delete Save £50 off the retail price of the LG 50PM470T 3D Television
Merchant Name SAVE50 Add Edit Delete Save £50 off the retail price of the LG 60PA650T 3D Television

all codes using SAVE50 go to the same edit ID, would there be another way of doing this to keep each entry to its own ID? means you can only put one of these codes live using the feed method.

Thanks

regards

Phil Stone
www.buy24-7.net

Submitted by support on Mon, 2013-02-25 15:21

Hi Phil,

Would that be better resolved through the multiple match fix which will be in the final version - so there would be a single, comma separated match_value field for each qualifying product for, in the example "MATCH50"?

This would impose a unique index on (merchant,voucher_code) which is logical given the enhanced matching - otherwise there wouldn't actually be any way to determine the difference on the List page - since multiple identical codes with different descriptions (one per valid product) is identical to a single code with each qualifying product listed in the description...

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Wed, 2013-02-27 00:54

This is impressive David - great work!

Be interested to know how to change to use the /feeds folder so we can get this all automated.

Cheers,

Tim

Submitted by support on Wed, 2013-02-27 11:13

Thanks for your comments, Tim!

For the upgrade version of the new voucher codes tool, you'll find the supplementary config file admin/voucher_code_config.php. Edit line 2 of that file and change to point to the feeds directory as follows:

  $config_voucherCodesFeedDirectory = "../feeds/";

You'll then be able to use the Automation Tool as normal to fetch voucher code feeds. Check back on Monday for an updated version of the upgrade in line with the 13/03A release in which I'll include a mod to filter out feeds that are already registered as normal product feeds from the Voucher Codes page.

13/03A itself includes a mod to the Automation Tool for selection of the download destination folder (feeds or voucherfeeds directory, as configured) as well as filename.

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Wed, 2013-02-27 16:50

Okay - I'll hold fire until the next release.

One thing I noticed which you may have caught already, is when adding voucher codes from the list, the select input doesn't seem to retain the merchant from the previous page? (Post mapping)

Tim

Submitted by support on Wed, 2013-02-27 20:06

Hi Tim,

Thanks for that - i've not been able to re-create so far; if you can recreate the issue on the demo site (username: demo, password: demo) could you post the "from" URL, and indicate which link goes through to the add voucher code page without being pre-selected. If you could also let me know browser / OS that would be a great help -

Thanks!
David.
--
PriceTapestry.com

Submitted by support on Mon, 2013-03-04 13:01

Hi Tim / all,

With today's release of Price Tapestry 13/03A, upgrade patch AdminUpgrade_From_1210B.zip has been updated as described above, specifically that if editing admin/voucher_codes_config.php to change $config_voucherCodesFeedDirectory in line with $config_feedDirectory in order to use the Automation Tool, any currently registered product feeds will not display on the Voucher Code feeds page.

13/03A supports the multiple matching logic as described above, but please note that this is not included in this patch since it requires modification to the voucher code application logic (from includes/tapestry.php) and search code (from search.php). However, should this be required; first apply the upgrade patch, and then email me those 2 files and I'll modify to support multiple matches as required.

Cheers!
David.
--
PriceTapestry.com

Submitted by philstone on Thu, 2013-04-25 08:44

Hi David

hope your well

was wondering if you could help me

I'm looking to add a code to a specific category and brand eg. american fridge freezers & Beko

is this possible whith the current voucher code?
regards

Phil Stone
www.buy24-7.net

Submitted by support on Thu, 2013-04-25 09:50

Hello Phil,

Not as it stands, but it's straight forward to add a "logical" match type. In includes/tapestry.php, look for the following code around line 188:

if ($voucher["match_value"])

...and REPLACE with:

if (strpos($voucher["match_value"],"&")!==FALSE)
{
  $parts1 = explode("&",$voucher["match_value"]);
  foreach($parts1 as $part1)
  {
    $parts2 = explode("=",trim($part1));
    if ($product[$parts2[0]]!=$parts2[1])
    {
      $isValid = FALSE;
      break;
    }
  }
}
elseif ($voucher["match_value"])

This new section of code will be invoked if the Match Value field of the voucher code record contains "&". To use, enter an expression comprising of field=value & field=value etc. for example:

category=American Fridge Freezers & brand=Beko

(match field and match type will be ignored in this case)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Thu, 2013-04-25 09:57

This works perfect David!

Thanks yet again!!

regards

Phil Stone
www.buy24-7.net

Submitted by Rocket32 on Sun, 2014-08-10 16:35

Hello David I'm having an issue with CJ vouchers. They put them in a folder on their server. Each day a new file is uploaded to this folder with voucher codes. The files contains several merchants with offers. At the end of month there is 30 feeds in the folder. The problem is how to would set up a fetch script or the automation script from feeds folder to capture the feed file each day or whatever day. The last numbers of the feed has the year and day labeled on it for identification. I would like to fetch this file every day, whatever day, or every week all 7 files. I would like to keep current offers & delete expired. Examples of the CJ files created in folder are 1453857_69566_20140801.txt, 1453857_69566_20140802.txt, 1453857_69566_20140803.txt, 1453857_69566_20140804.txt, etc.

Just trying to see how can I capture all these vouchers on the my PT site. First I have to get these somehow to the feeds or voucher feed folder, then get the feed separated due to several merchants or put them all on custom voucher page. Second the problem with the fetch scripts that I have, is they set up to fetch a file name & not a changing file name.

Submitted by support on Mon, 2014-08-11 10:36

Hi,

One way to do this is to add support for a placeholder %DATE% that you can use in the URL field of an Automation Tool job, which will be swapped out with YYYYMMDD. To do this, edit includes/automation.php and look for the following code at line 20:

  $job = $jobs[0];

...and REPLACE with:

  $job = $jobs[0];
  $job["url"] = str_replace("%DATE%",date("Ymd"),$job["url"]);

Then as the URL in your Automation Tool job, you could use, for example;

ftp://username:password@ftp.example.com/vouchers/1453857_69566_%DATE%.txt

Cheers,
David.
--
PriceTapestry.com