View Single Post
  #1  
Old 05-14-2017, 11:02 AM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,964
 

Default Admin Category Products Sale Updater

Hello Everyone,

We are constantly putting items on sale and taking others off sale. I have wanted a more efficient way of handling this without having to do export/edit/import. I finally got around to making the necessary changes in a couple of files.

The attached image shows 3 new columns tacked on to the right. On the Admin Category Products page you can now edit the 'List Price(market price)' and if you have the "On Sale Module' you can turn the 'Sale' ribbon on and off too. If you have a value in both Price fields you will see the amount of discount. If 'Your Price' is greater than the 'List(market price)' it will show 'P>L ?'.

Click image for larger version

Name:	admin_cat_prod_sale_updater.jpg
Views:	519
Size:	58.5 KB
ID:	4918

I hope this is of use to some of you and feel free to edit/correct what I've done.

Thanks,

Paul



In: include/process_product.php

After:
Code:
// Include 'avail' field into the updating list if (isset($v['avail']) && is_numeric($v['avail'])) $update[] = "avail='".intval($v["avail"])."'";

Add:
Code:
if (isset($v['list_price']) && is_numeric($v['list_price'])) $update[] = "list_price='".strval($v["list_price"])."'"; if (isset($v['on_sale'])) $update[] = "on_sale='".($v["on_sale"])."'";


In file: skin/common_files/main/products.tpl

Before:
Code:
</tr> {section name=prod loop=$products} <tr{cycle values=', class="TableSubHead"'}>

add:
Code:
<td nowrap="nowrap">{$lng.lbl_list_price} ({$config.General.currency_symbol})</a></td> <td nowrap="nowrap">Discount</td> {if $active_modules.On_Sale} <td nowrap="nowrap">{$lng.lbl_on_sale}</a></td> {/if}


Before
Code:
</tr> {/section} </table> {/if}


Add:
Code:
<td align="center"> {if $products[prod].product_type ne 'C'} <input type="text" size="9" maxlength="15" name="posted_data[{$products[prod].productid}][list_price]" value="{$products[prod].list_price|formatprice}"{if $products[prod].is_variants eq 'Y'} readonly="readonly" onclick="javascript: pvAlert(this);"{/if} /> {/if} </td> <td align="center"> {if $products[prod].product_type ne 'C'} {if $products[prod].list_price gt 0 && $products[prod].price gt 0} {if $products[prod].list_price gt $products[prod].price} {math equation="100 - (ourPrice / listPrice * 100)" ourPrice=$products[prod].price listPrice=$products[prod].list_price format="%.2f"}% {elseif $products[prod].list_price == $products[prod].price} 0% {else} P>L ? {/if} {/if} {/if} </td> {if $active_modules.On_Sale} <td align="center"> {if $products[prod].product_type ne 'C'} <select name="posted_data[{$products[prod].productid}][on_sale]"> <option value="N" {if $products[prod].on_sale eq "N"} selected="selected"{/if}>{$lng.lbl_no}</option> <option value="Y" {if $products[prod].on_sale eq "Y"} selected="selected"{/if}>{$lng.lbl_yes}</option> </select> {/if} </td> {/if}
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote