You are here:  » Simplified Discounts Page

Support Forum



Simplified Discounts Page

Submitted by GemViper on Thu, 2010-05-06 06:26 in

Hi David,

I'm working on a simplified way of offering my visitors current discounts from my various affiliates. Those affiliates provide me with a datafeed that all follows the same format as their regular products do so I thought this would be easy. I'd like to show all current offers on a single page, linked from the header area.

How it works (so far).

~ I combine and upload the discounts file as a datafeed called "Discounts", thus Discounts becomes the merchant.
~ I use the Product Name field to set the offer "title".
~ I use the Buy URL field to set the link to merchant.
~ I use the Price field to set the end date.
~ I use the Product Description field to set the websites name (the one offering the discount).

From there I can query the database by merchant looking only for "Discounts". I can then grab the other 4 variables and set them into a simple template that includes the header/footer/banner and search form as well as "includes common" and add the results in an unordered list. On my site I exclude product brands that have only one merchant so I could create a new brand called "discount brand" to ensure it doesn't show up anywhere else.

From there I'd just need to round up all of the special offers and discounts and upload them as an xml feed. What I need however is to code this so that it works without causing problems elsewhere. I'm not as good at coding as you are so any advice/examples are welcome. If you're too busy right now I'll copy the brands.php page and make changes to show the above but I'm not sure if using 2 pages would be better (html/code)? No hurry.

Gem

Submitted by support on Thu, 2010-05-06 08:23

Hello Gem,

One thing to point out is that the price field in the products table is of type DECIMAL (10,2), so is probably not appropriate for holding a date. Category and Brand are still available based on your implementation and are VARCHAR(255) so should be fine for holding a date...

It shouldn't cause _too_many problems, but one trick I think you can use to prevent the only major problem I can think of is to actually use the "normalised_name" field to hold the offer title; leaving name and searchname blank. This way, "products" from the "Discounts" merchant will never show up in search results.

The only other place it would need to be suppressed is in the merchants index (merchants.php), but this is easily handled. In that file, you'll find the following code on line 6:

  $sql = "SELECT DISTINCT(merchant) FROM `".$config_databaseTablePrefix."products` ORDER BY merchant";

...simply REPLACE that with:

  $sql = "SELECT DISTINCT(merchant) FROM `".$config_databaseTablePrefix."products` WHERE merchant <> 'Discounts' ORDER BY merchant";

Hope this helps!

Cheers,
David.