RE: Admin - Product Listing - Display Product Quantity
Aalst <[email protected]> 11 Sep 2003 21:02:10 -0000
| Newsgroups | gmane.comp.web.oscommerce.installation |
|---|---|
| Message-ID | <42422fe49e9e236153362700b62e1ba8@osCommerce-Forums> |
This message was sent from: Installation and Configuration
http://forums.oscommerce.com/viewtopic.php?p=228075#228075
----------------------------------------------------------------
I have long since corrected this problem on my own. Sorry for not posting my solution, I forgot about the post since I never received a response. I will try my best to describe my solution.
The [b]Admin - Product Listing - Display Product Quantity[/b] page is for how you want the multi-item column views of products to be setup. That means the SEARCH results which is [b]/catalog/advanced_search_result.php[/b], and when you drill down in the categories to one with items which is still the [b]/catalog/index.php[/b] page.
I had to go into the [b]/catalog/product_info.php[/b] and put in a MOD/Hack of my own to get the quantity to be displayed.
In this file you just need to add the snipit below in a PHP block where you would like to have the quantity displayed:
[code]$product_info['products_quantity'][/code]
Don't forget to give it a label so viewers of the page will know what the number means.
You need to make sure you place it after the line that defines it. It is [i]about line 73[/i] in a unmodified [b]/catalog/product_info.php[/b] file and the line looks like:
[code]$product_info = tep_db_fetch_array($product_info_query);[/code]
I am an English ONLY site so I do not mind short cutting and place language specific things right in the core files, however I think I will change this after writing this to make it cleaner. The line would look like this:
[code]<?php echo 'Quantity: ' . $product_info['products_quantity']; ?>[/code]
If you are a multi-language site you would want to put the words like "Quantity" into the correct language file [b]/catalog/includes/languages/(language)/product_info.php[/b].
Example would be to add a define to the list of existing defines in this file:
English:
[code]define('TEXT_PRODUCT_QUANTITY', 'Quantity');[/code]
Spanish:
[code]define('TEXT_PRODUCT_QUANTITY', 'Cantidad');[/code]
Then you would just add the variable within a PHP Block where needed, like so:
[code]<?php echo TEXT_PRODUCT_QUANTITY . ': ' . $product_info['products_quantity']; ?>[/code]
BTW, it is always good to surround your mods/hacks with comments like so:
Changes to:
[b]/catalog/includes/languages/english/product_info.php[/b]
[code]// BEGIN AALST Quantity MOD
define('TEXT_PRODUCT_QUANTITY', 'Quantity');
// END AALST Quantity MOD[/code]
Changes to:
[b]/catalog/product_info.php[/b]
[code]// BEGIN AALST Quantity MOD
<?php echo TEXT_PRODUCT_QUANTITY . ': ' . $product_info['products_quantity']; ?>
// END AALST Quantity MOD[/code]
This practice will help you in the future identify MODS/HACKS from core code. If you are replacing an existing line or modify an existing line I would recommend copying and pasting the line below itself, and commenting out the original and making note that it is the original in the comments. This will help to revert to the original code if there are problems later down the road.
I hope this helps someone...
-Aalst