You are here:  » Stock Levels


Stock Levels

Submitted by dbfcs on Tue, 2007-01-02 10:54 in

I am using custom feeds on one site.

How easy is it to add an in stock option to PT?

In the feed, I can add an extra column called (e.g.) InStock.

I would like to add some text to the site so that if the cell InStock is empty, the words "In Stock" appear. Otherwise, the words "Out of Stock" appear.

Thanks in advance.

Submitted by support on Tue, 2007-01-02 11:30

Hi Dave,

There's quite a lot of work involved in adding a new field, but there's instructions for doing it in the following thread:

http://www.pricetapestry.com/node/313

In that thread, you will also see instructions for using the new field throughout your site; look for references to the following variables:

$product["tariff"]
$mainProduct["tariff"]

In your case; rather that just displaying a variable you will want to create conditional output based on the variables value, for example:

<?php
  
if ($product["instock"])
  {
    print 
"In Stock";
  }
  else
  {
    print 
"Out of Stock";
  }
?>

Hope this helps!
Cheers,
David.

Submitted by dbfcs on Thu, 2007-01-04 11:59

Thanks for the code.

It took a while to hack away and add the extra field but the result is worth it.

I chose to grey out and strike through out of stock items so that visitors still can click on them if needs be.

Dave

Satellite Navigation Price Comparison Search

Submitted by jmrwv on Fri, 2007-01-05 00:51

Hello,

I don't actually have a field in my feed that indicates stock level, but I'd like to be able to accomplish this same thing. How would I implement something like this where the stock level changes based on the absence or presence of the product in the feed? When I import new feeds, products that are out of stock are no longer in the new feed and as a result they are removed from the database. This results in dead links, loss of product reviews, and lost search engine rankings. Any suggestions?

Thanks,
Jim

Submitted by support on Fri, 2007-01-05 09:25

Hi Jim,

Changes to be able to do this are even more complex than those described above - so in this instance if a product is removed from the feed just for being out of stock I would contact the merchant in the first instance as this will definitely be hurting their sales. Explain to them how you, and potentially lots of other affiliates, will be establishing pages to promote their produces and for the best effect need to keep those pages online for as long as the merchant is likely to be selling the product.

You could even ask them to include a stock indicator (several merchants / feeds do have this) and then implement using the methods described above...

Cheers,
David.

Submitted by D.Tzortzis on Fri, 2014-09-19 13:11

Hello David,

I need a little modification about the instock status, i use into config.advanced.php the follow custom field:
$config_fieldSet["instock"] = "in stock";

Then i use the follow code to print the stock status:

<?php
  
if ($product["instock"])
  {
    print 
"In Stock";
  }
  else
  {
    print 
"Out of Stock";
  }
?>

I need a modification about the fieldSet values and status:

mySQL Value: Y > Print > In Stock
mySQL Value: N > Print > Out Of Stock
mySQL Value: blank no data inserted > Print > Order Needed

Thanks,
D. Tzortzis.

Submitted by support on Fri, 2014-09-19 13:26

Hi,

A switch() statement is the most basic method to do this - have a go with:

<?php
  
switch ($product["instock"])
  {
    case 
"Y":
      print 
"In Stock";
      break;
    case 
"N":
      print 
"Out of Stock";
      break;
    default:
      print 
"Order Needed";
      break;
  }
?>

It could also be done by indexing an array with $product["instock"] but I'm not a big fan of using an empty string as an array key!

Cheers,
David.
--
PriceTapestry.com

Submitted by D.Tzortzis on Fri, 2014-09-19 18:15

As always excellent support David cheers!

Thank you
D. Tzortzis