[MOD] Wholesale prices - Display option

For Articles relating to more than one ISC version
Post Reply
Snooper
Posts: 264
Joined: Sat Jun 26, 2010 9:22 pm

[MOD] Wholesale prices - Display option

Post by Snooper »

I have a wholesale site where I only sell product in 'packs of''. So clearly I need to display the cost of that pack. However, and ideally, I also need to show the cost of one item (unit price) from within that pack. The problem is, ISC only lets you display one price to be either per Item or per Pack depending how presented to customers. My needs require both to be shown.

This is my approch to dealing with this, allbeit a simple approch - We start with a site using a single currency as an example.

If you go to ISC - Admin > Products > View Products > Edit (any product) > Pricing Options (other price options)

You arrive here -

Image

As you can see, you are able to enter the 'actual' Price of a product as well enter figures into 'Cost Price'. It is the input shown with an asterix you initally see public side and it is this that site maths (sale/ discounts/ VAT etc.) are calculated from. Cost Price when input, is nothing more than admin referance and hidden from public view. But my point is, this means both prices are now known for a product by ISC.

The graphic example below shows retail price and a lower cost price along side each other and is what we are trying to achieve.

Image

Go to lib/pricing.php and locate –

Code: Select all

	if($doLocaleFormat) {
		// Does this product have a RRP?
		if ($actualPrice > 0 && $actualPrice < $product['prodretailprice'] && $strikeOutRetail == true) {
			$rrp = CalcProdCustomerGroupPrice($product, $product['prodretailprice']);
			$rrp = ConvertPriceToCurrency($product['prodretailprice']);

			$output .= '<strike>'.FormatPrice($rrp).'</strike> ';
		}
	}

	if ($product['prodsaleprice'] > 0 && $product['prodsaleprice'] < $product['prodprice']) {
		$output .= '<span class="SalePrice">'.FormatPrice($actualPrice).'</span>';
	} else {
		$output .= FormatPrice($actualPrice);
                         {
And then modify three lines –

Code: Select all

if($doLocaleFormat) {
		// Does this product have a RRP?
		if ($actualPrice > 0 && $actualPrice < $product['prodretailprice'] && $strikeOutRetail == true) {
			$rrp = CalcProdCustomerGroupPrice($product, $product['prodretailprice']);
			$rrp = ConvertPriceToCurrency($product['prodretailprice']);

			$output .= '<strike>'.FormatPrice($rrp).'</strike> YYY<br/>';
		}
	}
 
	if ($product['prodsaleprice'] > 0 && $product['prodsaleprice'] < $product['prodprice']) {
		$output .= '<span class="SalePrice">'.FormatPrice($actualPrice).'</span> ZZZ '.FormatPrice($product['prodcostprice']).' ';
	} else {
		$output .= FormatPrice($actualPrice).' XXX '.FormatPrice($product['prodcostprice']).' ';
                         }
Note that there are three locations to be considered. I have used X, Y and Z respectively, to indicate what I mean. You would normally replace these with some appropriate wording. (ie. /pack and /item)

Now you go back to the Pricing Options page and complete the information required to make this mod relevant. Price is now wholesale price of a Pack. The other wise hidden element Cost Price now is entered.

The Products page will now show –

Image

And by example, the Products detail page now shows –

Image

Next we take a look at extending this process to a site using more than one currency.

The cost price of a product when entered, maybe used within ISC, but as we now know, not in a public capacity. This means when we use the array at point of display, it is very much stand alone and will not convert between currencies when asked.

So we now need to add this ability. Locate the section –

// Calculate the actual price for this product in the current currency
if($doCurrencyConvert == true) {
$actualPrice = ConvertPriceToCurrency($actualPrice);
}


And below this add –

$packPrice = CalcRealPrice($product['prodcostprice'], $product['prodretailprice'], 0, $product['prodistaxable']);
$packPrice = CalcProdCustomerGroupPrice($product, $packPrice);


And now we need to reflect these included lines into the script at point of display. The section below will be familiar (shown above). You can simply cut and past over your existing code, but the modification is –

Code: Select all

 	if($doLocaleFormat) {
		// Does this product have a RRP?
		if ($actualPrice > 0 && $actualPrice < $product['prodretailprice'] && $strikeOutRetail == true) {
			$rrp = CalcProdCustomerGroupPrice($product, $product['prodretailprice']);
			$rrp = ConvertPriceToCurrency($product['prodretailprice']);

			$output .= '<strike>'.FormatPrice($rrp).'</strike> Reduced<br/>';
		}
	}
 
	if ($product['prodsaleprice'] > 0 && $product['prodsaleprice'] < $product['prodprice']) {
		$output .= FormatPrice($packPrice).'/Item '.'<span class="SalePrice">'.FormatPrice($actualPrice).'</span>/Pack';
	} else {
		$output .= FormatPrice($packPrice).'/Item '.FormatPrice($actualPrice).'/Pack';
	}
Last edited by Snooper on Tue Jul 24, 2012 1:08 am, edited 4 times in total.
ISC 5.5.4 Ultimate : Being used here -- http://www.kdklondon.com
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: [MOD] Wholesale prices - Display option

Post by Tony Barnes »

This will only bite you in the ass if down the line you decide you want to use the site to generate profit records - if you're using the cost price for a wholesale price, then your reports will be all cocked up.

You could add in another field to the DB, and add another field into the backend for 'trade packs' - you could also have an additional field in there to say how many are in that trade pack, in case it varies depending on the product line. I've done this for someone in the past, wasn't too tricky, though was ages ago so can't recall for the life of me what I did in detail!!!

If you're happy you won't need cost price, or want to add any more dynamic info, then as you've outlined will work perfectly :)
Snooper
Posts: 264
Joined: Sat Jun 26, 2010 9:22 pm

Re: [MOD] Wholesale prices - Display option

Post by Snooper »

I figured that since the Cost Price is only ever used at Admin level, then why not just re-use it as such, but make its content public. There having been made a mark up pre-posting !

In theory we can back track the maths IF a report looks questionable. But point is taken ty. But this me we are talking too and what the heck do I know about SQL?? Considerably less than the subject of taxidermy. :? And no more then what sock to pull on first thing in the morning :lol:

However, if you can remember that mod, it would certainly be a useful one and would be good to add here.
Last edited by Snooper on Wed Apr 20, 2011 6:56 pm, edited 1 time in total.
ISC 5.5.4 Ultimate : Being used here -- http://www.kdklondon.com
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: [MOD] Wholesale prices - Display option

Post by Tony Barnes »

I'll have to try and find the site I did it on (!!!) - lost a lot of my custom code when my laptop died, this included, so would have to poach it back from live files... bah!
pakistangift
Posts: 1
Joined: Fri Sep 02, 2011 6:44 pm

Re: [MOD] Wholesale prices - Display option

Post by pakistangift »

Great info .

Flowers to Pakistan
Post Reply