Post by i2Paq » Sat Sep 25, 2010 8:41 pm

Have a good look at: Hide add to cart button for items not in stock?, here you find everything you need.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by dbe » Sat Sep 25, 2010 11:10 pm

Thanks i2Paq, I'll check it out!

The problem with this forum is, that there's loads of information available, but it gets hard finding the
right URL's...

Gr33tz

Dimitri Backaert
Web Development, Application Development, OOP, .NET, IBM Cognos BI


dbe
New member

Posts

Joined
Wed Sep 22, 2010 1:01 am
Location - Erembodegem - Belgium

Post by dramony » Thu Nov 11, 2010 1:19 pm

Qphoria wrote:
nzjollyroger wrote: however when you have pickup for shipping its show ups as:
is there some way to make it apply to everything but the free shipping ?
Try this:

Code: Select all

if ($format && (int)$value == 0) {
	$trace = debug_backtrace();
	if (isset($trace[1]) && $trace[1]['class'] == 'ModelShippingFree') {
		return "0.00";
	} else {
		return 'coming soon';
	}
}
Doesn't work on the Pick-up from Store

Active Member

Posts

Joined
Sat Oct 24, 2009 12:34 pm

Post by Qphoria » Fri Nov 12, 2010 11:08 am

I'm sure it does. Be sure you have the controller name correct

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by dramony » Fri Nov 12, 2010 12:16 pm

Thanks Q! In my case i used ModelShippingPickup so that 0.00 will appear on the Pick-up shipping page.
However, it doesnt appear right on the Cart module. Need more tweaks Q. Thanks again.

Active Member

Posts

Joined
Sat Oct 24, 2009 12:34 pm

Post by deeve » Thu Nov 18, 2010 4:13 pm

Hi Q,
is there a way to make the text substitution in this MOD only show once in Product Description page & Category pages if used in combination with 'Prices shown with & without VAT' - currently I get 'Call for Price' twice.. I'm using the code suggested in these two threads:

http://forum.opencart.com/viewtopic.php ... 25&start=0
http://forum.opencart.com/viewtopic.php ... 54#p112554

Thanks.

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by webmom » Wed Dec 15, 2010 1:12 am

Hi! I just upgraded to 4.9.1. I have Q's Option Price Update and Options Plus Mods installed - we sell things using weight-based options. I am trying to get this to work so that instead of a $0.00 price, it says "Please select weight option"
However, as the page loads, I can see the text "Please select weight option" flash - but then it disappears and is replaced with $NaN as the price. Selecting a weight option does not update the price (it remains $NaN). I appreciate any help - this is my first Opencart installation and so far it has been great!

Edit: Just to be clear - I am trying to make this work using the single edit to currency.php.

Newbie

Posts

Joined
Wed Dec 15, 2010 1:00 am

Post by deeve » Fri Jan 07, 2011 8:55 pm

Marcel wrote:Thanks this works nicely

My sold products are now in a Category called Sold and they show SOLD instead of a price.
My Free Shipping shows as 0.00 in Delivery Information

But here's the problem, in the final step of the checkout under Totals
the Free Shipping item shows as SOLD
..just wondered if anyone came up with a solution to this particular question +same problem appears in Product Options?

Thanks.

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by deeve » Mon Jan 10, 2011 7:59 am

I've been going over the php files for the 'checkout' & 'product options' controllers & suspect there's a way to use a line similar to

Code: Select all

if (isset($trace[1]) && $trace[1]['class'] == 'ModelShippingFree') {
in system/currency.php to specify those classes as well but can't for the life of me work out how to declare them!

Can anyone please enlighten me ..it's getting late here!

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by deeve » Wed Jan 12, 2011 12:58 am

Feels like I'm writing to myself on here these days :-\

I thought I needed to declare the 'ControllerCheckoutConfirm' class as well to solve the checkout problem but has had no effect when written like this:

Code: Select all

if ($format && (int)$value == 0) {
   			$trace = debug_backtrace();
   		if (isset($trace[1]) && $trace[1]['class'] == 'ModelShippingFree') {
      		return "£0.00";
   		} elseif (isset($trace[1]) && $trace[1]['class'] == 'ControllerCheckoutShipping') {
			return "£0.00";
		} else	{
      		return 'Call for Price';
   		}
		}
Anyone have any suggestions?

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by deeve » Thu Jan 13, 2011 1:24 am

Am going to continue talking to myself :D as the solutions I'm discovering may be of use to other php newbies like me..
Well, I have managed to solve the Checkout problem [only by lots of trial & error]:

Code: Select all

if ($format && (int)$value == 0) {
   			$trace = debug_backtrace();
   		if (isset($trace[1]) && $trace[1]['class'] == 'ModelShippingFree') {
      		return "£0.00";
		} elseif (isset($trace[1]) && $trace[1]['class'] == 'ModelTotalShipping') {
      		return "£0.00";
		} else {
      		return 'Call for Price';
   		}
		}
This works great but am still left with the problem of trying to display £0.00 within the Product Options drop-down list.. Feel free to chip in if anyone knows ;)

Got a hunch it should be 'ModelCatalogProduct' but how to separate this from Product's price & also am not sure you can have more than one instance of elseif ??

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by deeve » Thu Jan 13, 2011 5:48 pm

Okay, here's an interesting anomaly; I've just realized that within the product Options drop-down list, the items which are declared as +0.00 actually have nothing showing as an additional value, yet any item which has an additional value between 0 & 1, ie: +0.85 are the ones now showing as 'Call for Price'.

I've tried changing the initial line to:

Code: Select all

if ($format && (int)$value == 0.0000) {

&

Code: Select all

if ($format && (int)$value == 0.00) {
but with no joy.

Any ideas, feel free to pitch in.. ;)

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by deeve » Thu Jan 13, 2011 6:12 pm

Problem solved! All it needed was anextra '=' in the first line:

Code: Select all

if ($format && (int)$value === 0.00) {
   			$trace = debug_backtrace();
   		if (isset($trace[1]) && $trace[1]['class'] == 'ModelShippingFree') {
      		return "£0.00";
		} elseif (isset($trace[1]) && $trace[1]['class'] == 'ModelTotalShipping') {
      		return "£0.00";
		} else {
      		return 'Call for Price';
   		}
		}
**Added after I posted**

Not quite! Now the product's price is showing as £0.00 again - doh!

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by deeve » Fri Jan 14, 2011 12:36 am

Im really getting FED UP with this !! Now I get 'Call for Price' as it should be in Category view but then 0 in Product view ???

Code: Select all

if ($format && (int)$value == 0.00) {
   			$trace = debug_backtrace();
   		if (isset($trace[1]) && $trace[1]['class'] === 'ModelShippingFree') {
      		return "£0.00";
		} elseif (isset($trace[1]) && $trace[1]['class'] === 'ModelTotalShipping') {
      		return "£0.00";
		} elseif (isset($trace[1]) && $trace[1]['class'] === 'ControllerProductProduct') {
      		return "$value";
		} else {
      		return 'Call for Price';
   		}
		}
There has to be a way to distinguish between Option value and Product price..
Is there anyone still alive on this forum?

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by Qphoria » Fri Jan 14, 2011 1:05 am

There is no way to distinguish option value and product price because the calls for the currency format come from the product controller

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by deeve » Fri Jan 14, 2011 10:01 pm

Bummer, but thanks for clearing that up, Q.
I shall have no other option than to create a static Satellite page for those products then.

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by Jojon » Fri Aug 05, 2011 3:06 pm

whether it can support OpenCart v.1.5.1.1 ? :)

User avatar
New member

Posts

Joined
Sat Jun 04, 2011 4:11 pm

Post by ivex » Fri Sep 02, 2011 1:01 am

Qphoria you are a freakin genius!!!.......thanks so much.....works perfectly in 1.4.9.3
Qphoria wrote:A little trick to make this a lot easier for you..
Remember all prices pass through the currency->format() function, even if they are 0

1. EDIT: system/library/currency.php (or system/helper/currency.php for certain versions)

2. FIND:

Code: Select all

$string = '';
3. BEFORE, ADD:

Code: Select all

if ($format && (float)$value == 0) {
	return 'FREE';
}
That's it! One file handles ALL places.. even custom mods are automatically changed

Newbie

Posts

Joined
Sat Mar 12, 2011 7:04 am

Post by DJB31st » Fri Nov 11, 2011 5:23 pm

Just to clarify for anyone going through this post that you MUST use


if ($format && (float)$value == 0) {

rather than with an INT

If you use an INT anything at £0.99 or below will show as FREE

Cubecart to Opencart Migrations

KashFlow Accounting Integration with OpenCart


Newbie

Posts

Joined
Wed Jul 13, 2011 7:19 pm

Post by mldnkslvc » Wed Dec 14, 2011 11:12 am

deeve wrote:Im really getting FED UP with this !! Now I get 'Call for Price' as it should be in Category view but then 0 in Product view ???

Code: Select all

if ($format && (int)$value == 0.00) {
   			$trace = debug_backtrace();
   		if (isset($trace[1]) && $trace[1]['class'] === 'ModelShippingFree') {
      		return "£0.00";
		} elseif (isset($trace[1]) && $trace[1]['class'] === 'ModelTotalShipping') {
      		return "£0.00";
		} elseif (isset($trace[1]) && $trace[1]['class'] === 'ControllerProductProduct') {
      		return "$value";
		} else {
      		return 'Call for Price';
   		}
		}
There has to be a way to distinguish between Option value and Product price..
Is there anyone still alive on this forum?
Hi... elseif (isset($trace[1]) && $trace[1]['class'] === 'ControllerProductProduct') {
return "$value";
} this code is reduntant because it's said in the code above that if an amount is equal to 0 it displays call for price so all you need to do is to set product's price to 0 and it displays call for price on zero priced products.and another thing your code says to put a price in zero priced products.
to more expirienced programmers:

the code above works fine except it is now showing call for price instead of 0,00 amount in my cart in header.

i tried adding elseif ($trace[1] && $trace[1]['class'] === 'ControllerCheckoutCart') {
return "$value.00$symbol_right";
}
but it doesn't do the trick. what needs to be done to sort this out.Thanks in advance.

New member

Posts

Joined
Fri Dec 09, 2011 9:17 pm
Who is online

Users browsing this forum: No registered users and 1 guest