Post by GWeb » Tue Dec 03, 2013 4:11 pm

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:
Image

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:

Image

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.

Newbie

Posts

Joined
Tue Dec 03, 2013 3:50 pm

Post by jgsw » Tue Dec 03, 2013 6:34 pm

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

Quick Edit Admin Panel (40% off!) - CSS Unique (only $10!)
Sticky Admin Menu (Free) - Add Scripts & Styles to head (Free)


Active Member

Posts

Joined
Sat Mar 16, 2013 3:13 am

Post by GWeb » Wed Dec 04, 2013 2:32 am

Thank you for the help. I'll give it a try.

Newbie

Posts

Joined
Tue Dec 03, 2013 3:50 pm

Post by GWeb » Wed Dec 04, 2013 3:06 am

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!

Newbie

Posts

Joined
Tue Dec 03, 2013 3:50 pm

Post by Anthony1632 » Sun Mar 02, 2014 4:09 pm

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 .

Active Member

Posts

Joined
Sun Oct 14, 2012 10:02 am

Post by luctitus » Tue May 26, 2015 3:10 pm

-deleted-
Last edited by luctitus on Tue Jun 02, 2015 12:37 am, edited 1 time in total.

Newbie

Posts

Joined
Tue May 26, 2015 3:02 pm

Post by luctitus » Fri May 29, 2015 4:10 pm

-deleted-
Last edited by luctitus on Tue Jun 02, 2015 12:38 am, edited 1 time in total.

Newbie

Posts

Joined
Tue May 26, 2015 3:02 pm

Post by luctitus » Tue Jun 02, 2015 12:36 am

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

Newbie

Posts

Joined
Tue May 26, 2015 3:02 pm

Post by psjrules » Fri Jul 03, 2020 12:21 am

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>

Newbie

Posts

Joined
Fri Jan 11, 2019 6:57 pm
Who is online

Users browsing this forum: No registered users and 4 guests