
shapwill
New Members-
Posts
9 -
Joined
-
Last visited
shapwill's Achievements
Newbie (1/14)
14
Reputation
-
Hi zod, I'm glad you found it helpful! Please not that Point 2 was necessary for me in order to have discount vouchers calculated. Without this code, the voucher was showing up as "-20%" (for example) but the total below was not affected. If you found a simpler solution to show the discounted total, please let me know! Point 3: good to know; I only tried it with my theme so I wasn't sure what would apply to the Classic theme. Point 4 was necessary for me because the plugin supplied by my shipping partner adds the shipping cost at checkout. Thus, shipping cost was showing up as "free" (0) until the customer went to the checkout page and selected the shipping method, then the shipping cost would be updated and was no longer free. I needed the code in Point 4 in order to show the shipping cost once it was made available by the shipping module. Without the code at Point 4, the shipping cost remained hidden even after the shipping method was chosen.
-
That's really a different issue than what we've been discussing here, but I think the easiest solution would be to find the relevant entry for "Shipping" in the translations editor and change it to "Delivery", but that could end up changing more instances of the word than you'd like. For a more targeted solution addressing only particular instances of the word, look in the aforementioned files for the following line: {l s='Shipping' d='Modules.Shoppingcart.Shop'} and change s='Shipping' to s='Delivery'.
-
My site (running PS 1.7.6.5) uses a shipping module provided by our shipping provider, which adds the shipping price automatically based on the customer's address data. Thus, until the customer (or guest) has added their address at checkout, the cost of shipping is unknown. Instead of simply hiding this empty value (as one would expect), Prestashop shows the shipping as "Free", which is obviously misleading to the customer. The above solution did not solve my problem because it hides the shipping cost line forever. I want the shipping cost to show up when it is available (i.e. if the client has a registered address and the shipping module has added the price data). My solution is to hide the shipping cost (and not include it in the total) if it's 0. Here's how I solved the problem: (your files will vary, since I'm using a custom theme) Four files need to be modified: -themes/[theme name]/templates/checkout/_partials/cart-summary.tpl -themes/[theme name]/templates/checkout/_partials/cart-detailed-totals.tpl (for the cart and checkout pages) -themes/[theme name]/modules/ps_shoppingcart/ps_shoppingcart.tpl -themes/[theme name]/modules/ps_shoppingcart/modal.tpl (for the ajax cart preview) 1) cart-summary.tpl: replace everything inside {block name='cart_summary_subtotals'} with the following: {block name='cart_summary_subtotals'} <!--ADDED-->{if $cart.subtotals.shipping.value > 0} {foreach from=$cart.subtotals item="subtotal"} {if $subtotal && $subtotal.type !== 'tax'} <div class="cart-summary-line cart-summary-subtotals" id="cart-subtotal-{$subtotal.type}"> <span class="label">{$subtotal.label}</span> <span class="value">{$subtotal.value}</span> </div> {/if} {/foreach} {else} {foreach from=$cart.subtotals item="subtotal"} {if $subtotal.value && $subtotal.type !== 'tax' && $subtotal.type !== 'shipping'}<!--no shipping line if shipping cost is zero --> <div class="cart-summary-line cart-summary-subtotals" id="cart-subtotal-{$subtotal.type}"> <span class="label">{$subtotal.label}</span> <span class="value">{$subtotal.value}</span> </div> {/if} {/foreach} {/if}<!--END ADDED ---> {/block} 2) cart-detailed-totals.tpl: enclose the {foreach} statement with the following {if/else}, in which the {else} hides the shipping line if it's 0. <!--ADDED-->{if $cart.subtotals.shipping.value > 0} {foreach from=$cart.subtotals item="subtotal"} {if $subtotal.value && $subtotal.type !== 'tax'} <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}"> <span class="label{if 'products' === $subtotal.type} js-subtotal{/if}"> {if 'products' == $subtotal.type} {$cart.summary_string} {else} {$subtotal.label} {/if} </span> <h6 class="value">{$subtotal.value}</h6> {if $subtotal.type === 'shipping'} <div><small class="value">{hook h='displayCheckoutSubtotalDetails' subtotal=$subtotal}</small></div> {/if} </div> {/if} {/foreach} {else} {foreach from=$cart.subtotals item="subtotal"} {if $subtotal.value && $subtotal.type !== 'tax' && $subtotal.type !== 'shipping'}<!--no shipping line if shipping cost is zero --> <div class="cart-summary-line" id="cart-subtotal-{$subtotal.type}"> <span class="label{if 'products' === $subtotal.type} js-subtotal{/if}"> {if 'products' == $subtotal.type} {$cart.summary_string} {else} {$subtotal.label} {/if} </span> <h6 class="value">{$subtotal.value}</h6> </div> {/if} {/foreach} {/if} Then in the same file, add another {if/else} to change the total so that it won't include shipping if 0, but will account for any discounts/vouchers applied. (Since my site uses a comma as the decimal separator, I had to format the number accordingly here, followed by the current $currency.sign. <!-- ADDED-->{if $cart.subtotals.shipping.value > 0} <div class="cart-summary-line cart-total"> <span class="label">{$cart.totals.total.label} {$cart.labels.tax_short}</span> <h6 class="value">{$cart.totals.total.value}</h6> </div> {else} <div class="cart-summary-line cart-total"> <span class="label">{$cart.totals.total.label} {$cart.labels.tax_short}</span> <h6 class="value">{$cart.totals.total.amount - $cart.subtotals.shipping.amount|number_format:2:",":"."} {$currency.sign}</h6> </div> {/if}<!-- END ADDED--> 3) ps_shoppingcart.tpl: Modify div "cart-total" as follows: <div class="cart-total"> <!-- added-->{if $cart.subtotals.shipping.value > 0} <div>{l s='Shipping' d='Modules.Shoppingcart.Shop'}: <i>{$cart.subtotals.shipping.value}</i></div> {/if}<!-- end added--> {if $cart.subtotals.tax} <div>{$cart.subtotals.tax.label}: <i>{$cart.subtotals.tax.value}</i></div> {/if} {if Configuration::get('PS_TAX_DISPLAY')} <div>{$cart.totals.total_excluding_tax.label}: <i>{$cart.totals.total_excluding_tax.value}</i></div> <div>{$cart.totals.total_including_tax.label}: <i>{$cart.totals.total_including_tax.value}</i></div> {else} <!-- added-->{if $cart.subtotals.shipping.value > 0} <div>{$cart.totals.total.label}: <i>{$cart.totals.total.value}</i></div> {else} <div>{$cart.totals.total.label}: <i>{$cart.subtotals.products.value}</i></div> {/if}<!-- END added--> {/if} </div> 4) modal.tpl: Modify the "Total shipping" and "Total" code as follows: <!-- added-->{if $cart.subtotals.shipping.value > 0} <p><strong>{l s='Total shipping:' d='Shop.Theme.Checkout'}</strong> <i>{$cart.subtotals.shipping.value} {hook h='displayCheckoutSubtotalDetails' subtotal=$cart.subtotals.shipping}</i></p> {/if}<!-- END added--> {if $cart.subtotals.tax} <p><strong>{$cart.subtotals.tax.label}</strong> <i>{$cart.subtotals.tax.value}</i></p> {/if} <p><strong>{l s='Total' d='Shop.Theme.Checkout'}:</strong>  <!-- added-->{if $cart.subtotals.shipping.value > 0} <i>{$cart.totals.total.value}<span class="subtext">{$cart.labels.tax_short}</span></i> {else} <i>{$cart.subtotals.products.value}<span class="subtext">{$cart.labels.tax_short}</span></i> {/if}<!-- END added--> </p> This is working fine for me, but may need to be modified to suit your needs. I've attached the code here as well. ps_shoppingcart.tpl modal.tpl cart-detailed-totals.tpl cart-summary.tpl
-
Custom module translation problem
shapwill replied to Nomouku's topic in Addons, modules and themes developers
Thank you, Nomouku! This was very helpful! -
Cloning Bankwire module - prestashop v1.6.1.17
shapwill replied to johnchristy's topic in Core developers
I've managed to successfully create a clone of the ps_wirepayment module for Prestashop 1.7 (running 1.7.6.5) using Ed Eichman's blog post noted earlier in this thread. I've tested it and it seems to work fine; I was able to use it to display different bank account info depending on the client's chosen currency. To install, first use phpmyadmin to edit the psbb_configuration table: – Add PS_OS_BANKWIRE2 (I used value 99) to the configuration table, imitating PS_OS_BANKWIRE – Also add values to the tables order_state and order_state_lang imitating bankwire, using the same id_order_state value as PS_OS_BANKWIRE2 (99 in my case). – Install the attached module .zip using the BO modules installer. Configure and you'll find it under the name "Wire Transfer" in the Modules listing and Payment Preferences menu. With much added effort, I was able to add the translations for this module to the BO; you'll find them under "Installed Modules Translations" –> "Wire Transfer". *BUT* I could not figure out how to add the title of the payment method (what is shown to the customer at checkout) to the translation database, so you'll have to modify it by hand by editing ps_wiretransfer.php, line 197. For example, I wanted mine to state the currency of the bank account used: ->setCallToActionText($this->trans('Bank Transfer in EUR', array(), 'Modules.Wiretransfer.Shop')) If anyone can make this text translatable, please let us know! Enjoy! ps_wiretransfer.zip -
Hi folks, I'm trying to change the currency symbol for my site's (PS 1.7.6.3) default currency (Romanian lei) when the site is viewed in English and German. Prestashop is using odd built-in defaults that make no sense for these languages ("lei" in English and "L" in German) and I'd like to change both to "RON". I tried the following suggestion found elsewhere on these forums, but it did not work: <currency type="RON"> <displayName>Rumänischer Leu</displayName> <displayName count="one">Rumänischer Leu</displayName> <displayName count="other">Rumänische Leu</displayName> <symbol>RON</symbol> <symbol alt="narrow" draft="contributed">RON</symbol> <!--changed from "L"--> </currency> I changed relevant section of de.xml (above) and also copied it into de_DE.xml, then re-installed German localization (using local data, not downloading from server) with "currencies" checked. Likewise with en.xml and en_GB.xml. Reset cache, no change. Can anyone help?
-
Hi folks, I'm dealing with the same issue (PS 1.7.6.3) and despite trying every solution I've found on these forums, I have not managed to change the currency symbol for my site's default currency (Romanian lei) when the site is viewed in English and German. Prestashop is using odd built-in defaults that make no sense for these languages ("lei" in English and "L" in German) and I'd like to change both to "RON". I tried the solution offered by youo_1 above as such: <currency type="RON"> <displayName>Rumänischer Leu</displayName> <displayName count="one">Rumänischer Leu</displayName> <displayName count="other">Rumänische Leu</displayName> <symbol>RON</symbol> <symbol alt="narrow" draft="contributed">RON</symbol> <!--changed from "L"--> </currency> I changed relevant section of de.xml (above) and also copied it into de_DE.xml, then re-installed German localization (using local data, not downloading from server) with "currencies" checked. Likewise with en.xml and en_GB.xml. Reset cache, no change. Can anyone help?