[HACK] Fixed Shop by Price

For Articles relating to more than one ISC version
Post Reply
SamX
Posts: 14
Joined: Thu Jul 09, 2009 11:26 pm

[HACK] Fixed Shop by Price

Post by SamX »

Do you want to fix your shop by price?

Yes I want, im studing the lines and we need just modify the max product price and min product price.

It will be appear like this:
Shop by price:

* $0.00 - $100.00
* $100.00 - $150.00
* $150.00 - $200.00
* $200.00 - $250.00
* $250.00 - $300.00
* $300.00 - $350.00
* $350.00 - $400.00
* $400.00 - $450.00
* $450.00 - $500.00
Open includes/display/SideCategoryShopByPrice.php

On line 32 under if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {

Code: Select all

				$min = ceil($row['pmin']);
				$max = ceil($row['pmax'])
Change for this or the number you want

Code: Select all

			if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$min = 50;      // Minimum price product of your store
				$max = 500;   // Maximum price product of your store
In the line 38 you found:

Code: Select all

					$diff = (($max - $min) / 5	);
Change for this:

Code: Select all

					$diff = (($max - $min) / 9	);
Change the link 44

Code: Select all

					for ($i = 0; $i < 5; $i++) {   
For this:

Code: Select all

					for ($i = 0; $i < 9; $i++) {   
Thaths all!!! save and upload the file, i hope you like1
ISC 6.1.1 Multi-Vendor Edition
Snooper
Posts: 264
Joined: Sat Jun 26, 2010 9:22 pm

Re: [HACK] Fixed Shop by Price

Post by Snooper »

How would you start the price at 5 rather than 0 pounds??
ISC 5.5.4 Ultimate : Being used here -- http://www.kdklondon.com
CharlieFoxtrot
Confirmed
Confirmed
Posts: 413
Joined: Sun Aug 09, 2009 1:23 pm

Re: [HACK] Fixed Shop by Price

Post by CharlieFoxtrot »

Snooper wrote:How would you start the price at 5 rather than 0 pounds??
I agree that "zero-dollars" (pounds) looks a bit odd, and it should be changed to something other than "$0.00".

I'm not sure if this will help... but a quick fix could involve a simple search and replace just before the value of $output is returned.

Search For:

Code: Select all

$GLOBALS['SNIPPETS']['SideCategoryShopByPrice'] = $output;
Change To:

Code: Select all

// ORIGINAL LINE BELOW
// $GLOBALS['SNIPPETS']['SideCategoryShopByPrice'] = $output;
// REPLACE "$0.00" WITH THE WORD "Under"
$GLOBALS['SNIPPETS']['SideCategoryShopByPrice'] = str_replace("$0.00 -", "Under ", $output);
I'm a strong believer in commenting everything! I truly makes things easy if I ever have to return to my previous edits. I also like to preserve the original lines of code by commenting them out (instead of deleting them). In the event that something goes wrong, it's very easy to return to the original working code until I can figure out what the problem is.

FINAL NOTE: I haven't tested this... so if this does not work, please let me know and I'll post any corrections, or delete this post.

Charlie
ISC 4.0.7

"... and let's be honest that whole "by design" thing is getting old too."
Snooper
Posts: 264
Joined: Sat Jun 26, 2010 9:22 pm

Re: [HACK] Fixed Shop by Price

Post by Snooper »

Thanks for the replay..

tested.. and.. errrm.. how to put this.. *shruggs* Still starts with a 0 ?!! :D
ISC 5.5.4 Ultimate : Being used here -- http://www.kdklondon.com
CharlieFoxtrot
Confirmed
Confirmed
Posts: 413
Joined: Sun Aug 09, 2009 1:23 pm

Re: [HACK] Fixed Shop by Price

Post by CharlieFoxtrot »

Snooper wrote:Thanks for the replay..

tested.. and.. errrm.. how to put this.. *shruggs* Still starts with a 0 ?!! :D
Hmm... that's odd.

I just added that modification to my development site (ISC 4.07) and it works perfectly.

Sorry... maybe the difference in version numbers has something to do with it.

Good luck.
ISC 4.0.7

"... and let's be honest that whole "by design" thing is getting old too."
Snooper
Posts: 264
Joined: Sat Jun 26, 2010 9:22 pm

Re: [HACK] Fixed Shop by Price

Post by Snooper »

I have no idea c/fox.. Only the fact nothing works !!!

Under the line ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {

I have the following

Code: Select all

$row = $GLOBALS['ISC_CLASS_DB']->fetch($result);
		if(!$row) {
			$this->DontDisplay = true;
			return;
		}

		$min = ceil($row['pmin']);
		$max = ceil($row['pmax']);
Making the mod so that min = £5 and max = £100 for example.

Code: Select all

$row = $GLOBALS['ISC_CLASS_DB']->fetch($result);
		if(!$row) {
			$this->DontDisplay = true;
			return;
		}

		$min = 5;
		$max = 100;
I then mod the lines --

$diff = (($max - $min) / 5);

for ($i = 0; $i < 5; $i++) {


So they refer to only 4 steps of incrimination not 5..
This works, but starts with £0.00 - £24.00
I add your line by the swap you gave.. and get the same presentational result as above.

Attached is my PHP script.. you can see what may have changed… http://www.ihost4u.co.uk/inter/SideCate ... yPrice.zip

Otherwsie, good of you to have given this a shoot for me..
ISC 5.5.4 Ultimate : Being used here -- http://www.kdklondon.com
CharlieFoxtrot
Confirmed
Confirmed
Posts: 413
Joined: Sun Aug 09, 2009 1:23 pm

Re: [HACK] Fixed Shop by Price

Post by CharlieFoxtrot »

Just a shot in the dark... for the replacement string, try using "£0.00" instead of "$0.00".
ISC 4.0.7

"... and let's be honest that whole "by design" thing is getting old too."
Snooper
Posts: 264
Joined: Sat Jun 26, 2010 9:22 pm

Re: [HACK] Fixed Shop by Price

Post by Snooper »

perfect !!

brill stuff.. ty c/fox..
ISC 5.5.4 Ultimate : Being used here -- http://www.kdklondon.com
Post Reply