kerry Posted December 15, 2011 Share Posted December 15, 2011 I created the following script so that from the website if the product has no stock it does not show. Which is fine. <?php # Script to show products $page_title = 'Browse the Products'; require_once ('../mysqli_connect.php'); // shows the product if over 0 in stock $q="SELECT * FROM product WHERE product_category='fish' AND quantity_stock>'0'"; if (isset($_GET['pid']) && is_numeric($_GET['pid']) ) { $pid = (int) $_GET['pid']; if ($pid > 0) { // Overwrite the query: } } But, search engines are showing the product if it goes from outside of our websites. It is picking up the pid=(the product number) http://www.websiteaddress.co.uk/viewproduct.php?pid=329 Any ideas of a way around this? (except for deleting the product) - PHP version 5.3.5 - MYSQLI 5.0.7 Link to comment Share on other sites More sharing options...
Jonathon Posted December 15, 2011 Share Posted December 15, 2011 The problem with search engines are that they are outdated almost instantaneously. In your situation, you obviously want your products to be sold, so you want them in Google etc, but when they're out of stock, I wouldn't want them not in Google, because the next day they could be back in stock and many people will be prepared to wait for a product to come back in to buy, which is good for your business. The truth is that removing links from Google isn't actually that quick. You can request its removed from webmaster tools, but I don't know how easy it then is to index the page again. I genuinely think that if it was me i'd show every product but where there was no stock i'd indicate no stock "Out of stock - back soon" 1 Link to comment Share on other sites More sharing options...
kerry Posted December 15, 2011 Author Share Posted December 15, 2011 Hi Thanks for the reply. Its a good idea to indicate "no stock", "Out of stock - back soon" Any ideas on how I could add to the code above to show no stock when 0? Link to comment Share on other sites More sharing options...
Jonathon Posted December 16, 2011 Share Posted December 16, 2011 Well remove the 'greater than 0 clause' and use an if statement to see if quantity did equal 0. If so maybe print a css class that shows an out of stock icon or something?Or even just print some text if its out of stock? 1 Link to comment Share on other sites More sharing options...
rob Posted December 16, 2011 Share Posted December 16, 2011 In addition to Jonathon's comments, I don't think it's great to hide any product unless you're discontinuing it. Amazon allow you to purchase even if the item is not in stock - I'm sure I've done this with two of Larry's new books in the past, they had order early discounted prices. On a recent ecommerce project, I had item pages without stock state "Stock on order" with both a form to enter a contact email address(to be notified when stock was in) and the addition of thumbnail images/links for similar products in stock. 1 Link to comment Share on other sites More sharing options...
Recommended Posts