In your top level language file (ie. "catalog/language/english/english.php"), insert the following:-
Code: Select all
$_['text_no_price'] = 'Coming Soon';
- catalog/controller/product/category.php
catalog/controller/product/manufacturer.php
catalog/controller/product/search.php
catalog/controller/product/special.php
catalog/controller/product/product.php
Code: Select all
$this->data['text_no_price'] = $this->language->get('text_no_price');
Code: Select all
if ($discount) {
$price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($result['product_id']);
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
}
}
Code: Select all
if ($discount) {
$price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax')));
} else {
if ($result['price'] == 0) {
$price = $this->language->get('text_no_price');
} else {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($result['product_id']);
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
}
}
Code: Select all
if ($discount) {
$this->data['price'] = $this->currency->format($this->tax->calculate($discount, $product_info['tax_class_id'], $this->config->get('config_tax')));
$this->data['special'] = FALSE;
} else {
$this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($this->request->get['product_id']);
if ($special) {
$this->data['special'] = $this->currency->format($this->tax->calculate($special, $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$this->data['special'] = FALSE;
}
}
Code: Select all
if ($discount) {
$this->data['price'] = $this->currency->format($this->tax->calculate($discount, $product_info['tax_class_id'], $this->config->get('config_tax')));
$this->data['special'] = FALSE;
} else {
if ($product_info['price'] == 0) {
$this->data['price'] = $this->language->get('text_no_price');
} else {
$this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
}
$this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($this->request->get['product_id']);
if ($special) {
$this->data['special'] = $this->currency->format($this->tax->calculate($special, $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$this->data['special'] = FALSE;
}
}
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
However, I haven't been able to get it to work on the category pages.
Here's what my code looks like in category.php
Code: Select all
$special = $this->model_catalog_product->getProductSpecial($result['product_id']);
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = FALSE;
}
In the controller files previously mentioned, you will find a block of code that reads:
Code: Select all
$this->data['products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => HelperImage::resize($image, $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height')),
'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))),
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite($this->url->http('product/product&product_id=' . $result['product_id']))
);
Code: Select all
if ($result['price'] == 0) {
$price = $this->language->get('text_no_price');
} else {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
}
Code: Select all
'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))),
Code: Select all
'price' => $price,
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
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 = '';
Code: Select all
if ($format && (float)$value == 0) {
return 'FREE';
}
if ($format && (int)$value == 0) {
return 'coming soon';
}
it shows up perfect.
however when you have pickup for shipping its show ups as:
Pickup Up: and in the price instead of 0.00 is shown as 'coming soon'
which is a problem i completely understand why... but
is there some way to make it apply to everything but the free shipping ?
Try this: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 ?
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';
}
}
Qphoria wrote:Try this: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 ?
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'; } }
Ok, I understand this.Qphoria wrote:Burrito is correct. The way options were designed in OpenCart was to make the product price the default option price. Leaving the default option at 0.00
Example
But,... I have only one price for the product with 4 diferent optional samples (their price = 0€)
When add a product in this way:
product_A - 12.10 €
options: sample_1 - 0 €, sample _2 - 0 €, sample_3 - 0 €, sample_4 - 0 €
.... The price is clearly visible, but when the product is added to the basket, there is no price, only is displayed 0.00 €, do not fall in the amount of purchase!
and when add a product in second way:
product_A - 0.00 €
options: sample_1 - 12.10 €, sample _2 - 12.10 €, sample_3 - 12.10 €, sample_4 - 12.10 €
Now price is visible in the cart and counted to sub-total but on the product list and view the price of product_A is 0.00 €! I think this is a little frivolous to our customers.
I tried this code:
if ($format && (int)$value == 0) {
$trace = debug_backtrace();
if (isset($trace[1]) && $trace[1]['class'] == 'ModelShippingFree') {
return "0.00";
} else {
return 'Price depends on choice options';
}
}
I think it's not really suitable solution because it is essentially only one price for this product. I have also a few items without options, but their price is less than 1, for example price is € 0.45 and in these item is still visible sign "Price depends on choice options" instead of price!
Otherwise I really like OpenCart. Is friendly, transparent, modern, and so I decided that I worked with him (until now I have used Zencart).
I hope you will help me in eliminating errors and defects that sometimes occur.
Thanks in advance
PS: I Using OC v1.4.4
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
OpenCart Newbie | Using v1.5.1.1
I want one specific product to provide a POA type message and the customer be able to complete the order.
Cheers
A stupid question is the one you -don't- ask.........(Anon)
)C1.5.0.1 (IN devel)
OC V1.4.9.5
OC V1.4.9.2
OC V1.4.7
OC V1.3.4
Hi Qphoria,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:3. BEFORE, ADD:Code: Select all
$string = '';
That's it! One file handles ALL places.. even custom mods are automatically changedCode: Select all
if ($format && (int)$value == 0) { return 'FREE'; }
Concerning the above post I quoted:
is there any way you can display the hardcoded text (in this case 'FREE') in multiple languages?
I'm stuck at that part...
Dimitri Backaert
Web Development, Application Development, OOP, .NET, IBM Cognos BI
Code: Select all
$_['text_free'] = 'Free';
Then change the currency.php file to use
Code: Select all
if ($format && (int)$value == 0) {
return $this->language->get('text_free');
}
Hi Qphoria,Qphoria wrote:add an entry into the main language file for each language (english.php, spanish.php, etc)Code: Select all
$_['text_free'] = 'Free';
Then change the currency.php file to useCode: Select all
if ($format && (int)$value == 0) { return $this->language->get('text_free'); }
Thanks for the solution.
In the Front End, it works.
In the Admin part however, i get the message 'text_no_price' (which is the name of my language file entry).
Any solution for that?
Greets
Dimitri Backaert
Web Development, Application Development, OOP, .NET, IBM Cognos BI
The Admin section has a separate language file.
Thanks for pointing that out.
I seem to have some other problems now.
All products having the standard text value 'FREE' are messing up the actual shopping cart.
When adding these products to the cart, the subtotal and total values don't seem to be working
correctly.
Ideally, a customer should not be able to add these products to the shopping cart.
In fact, this section should be some sort of image gallery, displaying the product examples, and
having a standard text or a link to an e-mail address, to ask for more information.
Dimitri Backaert
Web Development, Application Development, OOP, .NET, IBM Cognos BI
Users browsing this forum: No registered users and 16 guests