Hello David
I'm already using the voucher code mod shown at http://www.pricetapestry.com/node/2079
Could there be a way of getting something similar where 1 merchant has asked me to show a discount code on 5 of their products.
So they don't want it to appear on all of their products,
This will be used on my Magazine Subscription website
Thanks Mally
hi dave
started using this mod on my site this week, its great!!!!
was wondering, is there a mod that could be done so say you have a /tv/ sub category and codes are not relevant but they are relevant to the /laptops/ sub category you can say have eg: tvs_comet.txt or laptops_comet.txt, specific products would obviously remain the same as they only show for a specific product name, if its not possible no worries, just thought it would streamline codes a little more.
many thanks yet again!!!
Phil Stone
www.buy24-7.net
Hi Phil,
Sure - you can modify the above to take in category_merchant voucher (in the middle, so the priority would be product_merchant, category_merchant, merchant). Have a go with:
if (file_exists("vouchers/".$product["merchant"]."_".$product["name"].".txt"))
{
require("vouchers/".$product["merchant"]."_".$product["name"].".txt");
}
elseif(file_exists("vouchers/".$product["category"]."_".$product["merchant"].".txt"))
{
require("vouchers/".$product["merchant"].".txt");
}
elseif(file_exists("vouchers/".$product["merchant"].".txt"))
{
require("vouchers/".$product["merchant"].".txt");
}
Cheers,
David.
--
PriceTapestry.com
Hi Phil,
I'm assuming all sub-domains are pointing to the same installation; so yes - you can extract the subdomain name into a variable as follows;
$subdomain = str_replace(".example.com","",$_SERVER["HTTP_HOST"]);
(where .example.com is your main domain name)
So that can be used in the above code as follows; of course you can move them around depending on priority;
$subdomain = str_replace(".example.com","",$_SERVER["HTTP_HOST"]);
if (file_exists("vouchers/".$product["merchant"]."_".$product["name"].".txt"))
{
require("vouchers/".$product["merchant"]."_".$product["name"].".txt");
}
elseif(file_exists("vouchers/".$product["category"]."_".$product["merchant"].".txt"))
{
require("vouchers/".$product["merchant"].".txt");
}
elseif(file_exists("vouchers/".$subdomain."_".$product["merchant"].".txt"))
{
require("vouchers/".$product["merchant"].".txt");
}
elseif(file_exists("vouchers/".$product["merchant"].".txt"))
{
require("vouchers/".$product["merchant"].".txt");
}
Cheers,
David.
--
PriceTapestry.com
unfortunately i have it set-up as separate installations, does that rule this out? The feeds are all from a shared file, but separate installations for the main sub domain categories.
regards
Phil Stone
www.buy24-7.net
Hi Phil,
That probably makes it easier to be honest - no need for sensing the domain name if they are separate installations - simply put the appropriate voucher code files into the appropriate installation folders, e.g. laptops vouchers into
/laptops/vouchers/
- with filenames /laptops/vouchers/merchant_product.txt (first priority) and /laptops/vouchers/merchant.txt etc, using the original code:
if (file_exists("vouchers/".$product["merchant"]."_".$product["name"].".txt"))
{
require("vouchers/".$product["merchant"]."_".$product["name"].".txt");
}
elseif(file_exists("vouchers/".$product["merchant"].".txt"))
{
require("vouchers/".$product["merchant"].".txt");
}
That should be all you need to do!
Cheers,
David.
--
PriceTapestry.com
Hello Mally,
Sure - a simple extension of that modification would be to first check for
/vouchers/Merchant Name_Product Name.txt
...before checking for
/vouchers/Merchant Name.txt
So then you could upload the same voucher content for each of the 5 relevant products as:
/vouchers/Merchant Name_Product Name1.txt
/vouchers/Merchant Name_Product Name2.txt
etc. etc.
...so your code would look something like:
<?php
if (file_exists("vouchers/".$product["merchant"]."_".$product["name"].".txt"))
{
require("vouchers/".$product["merchant"]."_".$product["name"].".txt");
}
elseif(file_exists("vouchers/".$product["merchant"].".txt"))
{
require("vouchers/".$product["merchant"].".txt");
}
Hope this helps!
Cheers,
David.