Page 1 of 1
Adjust Shipping Text Variable & Keeping Value Variable at 0
Posted: Tue Dec 03, 2013 4:11 pm
by GWeb
We are using OpenCart to setup an ordering system for a client of ours. Managers across the country will be placing orders through our website but all payments will be invoiced at a future time directly to the corporate accounting department. I would like to modify the "Flat Rate" shipping extension to show "N/A" for the price and have a value of "0".
I would want it to look like this:
If I try and set the "Cost" to "N/A" in the shipping extension, it still shows "$0.00" as the cost of shipping on the checkout page. Since we will be charging shipping costs in the final invoice that we create with our other accounting software, I do not want to mislead our client into thinking that shipping is "$0.00". I want it to say "N/A".
Can I adjust the "Cost" parameter to have a text variable instead of a number (i.e. "N/A" instead "0")? I see where I can do this in the database to already placed orders:
How can I make it so that the checkout screen shows "N/A" instead of "$0.00"?
Thanks in advance. I'm totally new to OpenCart and am still trying to wrap my head around it all.
Re: Adjust Shipping Text Variable & Keeping Value Variable a
Posted: Tue Dec 03, 2013 6:34 pm
by jgsw
Hi GWeb,
A quick hack would be to edit the template files so that the only thing changed is what the customer sees.
In catalog/view/theme/default/template/checkout/shipping_method.tpl
Find:
Code: Select all
<?php foreach ($shipping_method['quote'] as $quote) { ?>
Add this on the next line:
Code: Select all
<?php if ($quote['code'] == "flat.flat") { $quote['text'] = "N/A"; } ?>
In catalog/controller/checkout/confirm.php
Find:
Code: Select all
<?php foreach ($totals as $total) { ?>
Add this on the next line:
Code: Select all
<?php if ($total['title'] == "Flat Shipping Rate") { $total['text'] = "N/A"; } ?>
This will display N/A for the flat rate module.
Bear in mind it must be called "Flat Shipping Rate" as in the above line of code. If is is called something else change the above line of code to reflect this. If your site is multilingual you may need to replicate the above line of rode for each language.
jgsw
Re: Adjust Shipping Text Variable & Keeping Value Variable a
Posted: Wed Dec 04, 2013 2:32 am
by GWeb
Thank you for the help. I'll give it a try.
Re: Adjust Shipping Text Variable & Keeping Value Variable a
Posted: Wed Dec 04, 2013 3:06 am
by GWeb
Again, thank you for the help jgsw. Worked perfectly. (The path for the second file on my system is catalog/view/theme/default/template/checkout/confirm.tpl. Maybe your setup is different? Regardless, I found the "$totals as $total" line and added your suggestion underneath and it worked!)
A couple quick follow-up questions.
(1) Do you know where I can find where to adjust the variable for the confirmation email that gets sent out?
(2) Is there a way to change what gets added to the database? When I check the database, in the table "cmq_order_total", there is a field titled "text". Do you know where I can adjust the variable that gets sent to that database?
Thanks again!
Re: Adjust Shipping Text Variable & Keeping Value Variable a
Posted: Sun Mar 02, 2014 4:09 pm
by Anthony1632
How would this work with a FREE SHIPPING that i renamed to "Shipping quote setting will change after order" . Which are the variable then to change? I see here flat.flat and Flat Shipping Rate .
Re: Adjust Shipping Text Variable & Keeping Value Variable a
Posted: Tue May 26, 2015 3:10 pm
by luctitus
-deleted-
Re: Adjust Shipping Text Variable & Keeping Value Variable a
Posted: Fri May 29, 2015 4:10 pm
by luctitus
-deleted-
Re: Adjust Shipping Text Variable & Keeping Value Variable a
Posted: Tue Jun 02, 2015 12:36 am
by luctitus
Sorry for the double post.
In addition to the above, I think you will need to edit the following too :
catalog/view/theme/default/template/mail/order.tpl - For Sent Out Email
catalog/view/theme/default/template/account/order_info.tpl - For Order History / Info
Just sharing
Re: Adjust Shipping Text Variable & Keeping Value Variable at 0
Posted: Fri Jul 03, 2020 12:21 am
by psjrules
Hello, how would you do this in Open Cart 3.0.3.2 ? I checked the file and it has considerably changed from what it was in 2013 (Obviously expected)
The file looks like this now:
============
{% if error_warning %}
<div class="alert alert-warning alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}</div>
{% endif %}
{% if shipping_methods %}
<p>{{ text_shipping_method }}</p>
{% for shipping_method in shipping_methods %}
<p><strong>{{ shipping_method.title }}</strong></p>
{% if not shipping_method.error %}
{% for quote in shipping_method.quote %}
<div class="radio">
<label> {% if quote.code == code or not code %}
{% set code = quote.code %}
<input type="radio" name="shipping_method" value="{{ quote.code }}" checked="checked" />
{% else %}
<input type="radio" name="shipping_method" value="{{ quote.code }}" />
{% endif %}
{{ quote.title }} - {{ quote.text }}</label>
</div>
{% endfor %}
{% else %}
<div class="alert alert-danger alert-dismissible">{{ shipping_method.error }}</div>
{% endif %}
{% endfor %}
{% endif %}
<p><strong>{{ text_comments }}</strong></p>
<p>
<textarea name="comment" rows="8" class="form-control">{{ comment }}</textarea>
</p>
<div class="buttons">
<div class="pull-right">
<input type="button" value="{{ button_continue }}" id="button-shipping-method" data-loading-text="{{ text_loading }}" class="btn btn-primary" />
</div>
</div>