You are here:  » adding a feed with no prices?

Support Forum



adding a feed with no prices?

Submitted by mally on Thu, 2008-03-27 17:17 in

Hello David

Is it possible to add a feed without any prices shown and simply make it so it appears click here where the price should be in the table?

thanks

Mally
magazine subscription

Submitted by support on Thu, 2008-03-27 17:25

Hi Mally,

Sure - the main thing of course is modifying the import routine so that price is not a mandatory field. First in includes/feeds_register_step2.php, delete or comment out the following code (line 33)

widget_required("fieldPrice");

Then, in includes/admin.php remove or comment out the following block of code starting at line 32:

    if (!$fieldPrice)
    {
      return "fieldPrice missing";
    }

...modify the following code (starting at line 157):

    /* check product record for minimum required fields */
    if (!$record[$admin_importFeed["field_name"]] || !$record[$admin_importFeed["field_buy_url"]] || !$record[$admin_importFeed["field_price"]]) return;

...as follows:

    /* check product record for minimum required fields */
    if (!$record[$admin_importFeed["field_name"]] || !$record[$admin_importFeed["field_buy_url"]]) return;

...and finally delete or comment out the following code on line 168:

$record[$admin_importFeed["field_price"]] = tapestry_decimalise($record[$admin_importFeed["field_price"]]);

The above modifications will enable you to register a field without the price field. Having done that, it is then just a case of removing the price display code from:

html/searchresults.php
html/product.php
html/prices.php

As these are probably quite heavily modified, drop them to me in an email if you need help removing the price components of these...

Cheers,
David.

Submitted by mally on Thu, 2008-03-27 17:38

Quick reply David, much appreciated.

Just to confirm, if I do the above, will the feeds with prices still show ok?

I've got about 7 feeds, its just an additional feed I've being given doesn't have prices but I would still like to add it

Cheers

Mally

Submitted by support on Thu, 2008-03-27 17:43

Hi,

Ah - in that case just ignore the last instruction to comment out the call to tapestry_decimalise() - it won't matter for the empty prices and can still do its job for the feeds that do have prices.

You then probably want to make price display conditional within the HTML files so let me know if you need any help with that. One option is to use code such as:

<?php if ($product["merchant"] != "No Prices Merchant"): ?>
...price relevant HTML here...
<?php endif; ?>

Cheers,
David.

Submitted by mally on Thu, 2008-03-27 19:34

Hello David

The code works well, only issue is that it is showing price 0.00 for the all the items in the product item, e.g

Beautiful Cards Magazine

I added code that gave the results for so all the merchants appeared, not just the ones that sold the product.

Could you explain how I could change the 0.00 to show "Overseas" and for it to appear at the bottom of the table?

If you need any of my html files I'll send them

Cheers!

Mally

Submitted by support on Thu, 2008-03-27 20:07

Hi Mally,

Ah - yes, a zero price is always going to show up top. Could you send me over products.php and html/searchresults.php and i'll have a think about the best way to do this...

Cheers,
David.

Submitted by mally on Thu, 2008-03-27 20:13

thanks David

Sent an email to you with files

Submitted by harican on Fri, 2008-07-25 11:24

What php code can be inputted into these files to show "price not available" instead of $0.00
html/searchresults.php
html/product.php
html/prices.php

Submitted by support on Fri, 2008-07-25 11:42

Hi,

html/searchresults.php

Change the following code within line 28:

<?php print $config_currencyHTML.$product["price"]; ?>

to:

<?php print ($product["price"]>0?$config_currencyHTML.$product["price"]:"Price Not Available"); ?>

html/product.php

Change the following code within line 23:

<?php print $config_currencyHTML.$mainProduct["price"]; ?>

to:

<?php print ($mainProduct["price"]>0?$config_currencyHTML.$mainProduct["price"]:"Price Not Available"); ?>

html/prices.php

...exactly the same change as searchresults.php, but the code can be found on line 13.

Cheers,
David.

Submitted by harican on Fri, 2008-07-25 13:05

Works wonderfully, thanks.