Contributions
Products_Sold
version 1.0
For MS2
This module allows you to choose in the admin menu if a product is sold or not.
It's particularly useful for real estate web site.
If you selected 'sold' for a product in the admin, then it display an icon 'sold' in front of the product in the product_listing.php and product_info.php pages and the buttons 'in_cart' and 'buy_now' are not displayed.
It is different of the 'status' option because the product is still displayed even if it's sold.
Expand All / Collapse All
In previous version, there is a mistake in the install.txt file: in catalog/admin/categories.php, a bad name of field was asked to insert in a query.
This version corrects this bug.
It also corrects the bug find by George Burk and adds the update of darkgugu below (thanks to them).
Complete package.
Just some update I made for products_new.php with previous contribution.
in ./catalog/products_new.php
ADD p.products_quantity, p.products_sold to the query
$products_new_query_raw = "select p.products_id, pd.products_name ..."
Following " <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>"
Add
<?php if ($products_new['products_sold'] == '0') { ?>
<td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
<?php } ?>
<?php if ($products_new['products_sold'] == '1') { ?>
<td class="main" align="right"><?php echo tep_image (DIR_WS_LANGUAGES . $language . '/' . DIR_WS_IMAGES . 'sold.gif', '', SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align=right'); ?></td>
<?php } ?>
simple bug found in code that was displaying the BUY NOW button for sold out products, while hiding the BUY NOW button for in-stock products.
-----------------------------------------------
Change this line in 'catalog/includes/modules/product_listing.php' FROM:
if ($listing['products_sold'] == '0') {
TO:
if ($listing['products_sold'] == '1') {
---------------------------------------------
That's all! Now it works!
File included is re-packaged zip with corrected install instructions.
version 1.0
For MS2
This module allows you to choose in the admin menu if a product is sold or not.
It's particularly useful for real estate web site.
If you selected 'sold' for a product in the admin, then it display an icon 'sold' in front of the product in the product_listing.php and product_info.php pages and the buttons 'in_cart' and 'buy_now' are not displayed.
It is different of the 'status' option because the product is still displayed even if it's sold.
Note: Contributions are used at own risk.