VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: kalestud on August 22, 2016, 13:03:34 PM

Title: Remove "+" from shipment_cost fee on edit_shipment (SOLVED)
Post by: kalestud on August 22, 2016, 13:03:34 PM
Hi there,

Is there any way to get rid of the + sign displayed on edit_shipment for the shipping costs?
Thing is, we don't charge for shipping, but we want to grand a discount to people who pickup their parcel.
It all works well, the rate is negative, but it now shows + and - and that has proven to be confusing for people.
Having the sign and symbol the other way around in my currency is not an option, becuase the display is way better on the cart and invoice like it is.

So basic question: Where is the + symbol put in (that's the one I try to get rid off) ? Can't find it anywhere!!!
(also why is it there, you can format your positive numbers in the currency anyway?)

VM 3.0.16 & J! 3.6.2
Title: Re: Remove "+" from shipment_cost fee on edit_shipment
Post by: kalestud on August 22, 2016, 16:02:51 PM
Okay,

for now I found a workaround by hiding the fee (CSS):

/component/com_virtuemart/assets/css/vm-ltr-site.css
Around line 1106
hide .vmshiment_cost by taking it from previous group and specify hidden

.vmpayment_name, .vmpayment_cost, .vmshipment_name{
  padding: 0 2px;
}

.vmshipment_cost{
visibility: hidden;
}

Would still like to know how to get rid of the + and why it's there in the first place!
Title: Re: Remove "+" from shipment_cost fee on edit_shipment
Post by: GJC Web Design on August 22, 2016, 18:24:33 PM
it is hardcoded in the  administrator\components\com_virtuemart\plugins\vmpsplugin.php

$costDisplay = '<span class="'.$this->_type.'_cost fee"> ('.$fee.' +'.$costDisplay.")</span>";

I always over ride the function getPluginHtml ($plugin, $selectedPlugin, $pluginSalesPrice) in my ship plugs so I can control the display
Title: Re: Remove "+" from shipment_cost fee on edit_shipment
Post by: kalestud on August 22, 2016, 18:39:35 PM
You're a beauty!
Staring me right in the face (of course)!!!
Title: Re: Remove "+" from shipment_cost fee on edit_shipment (SOLVED)
Post by: Milbo on August 23, 2016, 20:44:30 PM
As far as I know, you can do that by a simple Language override. no?
Title: Re: Remove "+" from shipment_cost fee on edit_shipment (SOLVED)
Post by: GJC Web Design on August 23, 2016, 21:08:38 PM
nope - this is hard coded

$costDisplay = '<span class="'.$this->_type.'_cost fee"> ('.$fee.' +'.$costDisplay.")</span>";
Title: Re: Remove "+" from shipment_cost fee on edit_shipment (SOLVED)
Post by: kalestud on August 24, 2016, 10:44:37 AM
Hi there Milbo,

no that was my first guess, of course.

Also, I checked the currency display. Not possible to get rid of it there.
Now that I got the + out, I tried adding it to the positive values, but it then puts it everywhere, where there is a price or value mentioned.
So that was no good, in reaction to my own suggestion  :P

The right thing to do would be to add it when there's a fee involved.
When someone wants to pay by creditcard (+2%) it shows a + €0,29 or such behind the selected method.

Maybe that would be on the wishlist for future VM editions?
Title: Re: Remove "+" from shipment_cost fee on edit_shipment (SOLVED)
Post by: Agaton on February 24, 2017, 13:22:43 PM
Quote from: Milbo on August 23, 2016, 20:44:30 PM
As far as I know, you can do that by a simple Language override. no?

You are right Milbo, it is a simple language override but many people will not find it as the language override is "COM_VIRTUEMART_PLUGIN_COST_DISPLAY", which is set as "Discount/Fee:".

Unless you look directly at the code you will not realise that you have set the code to split the value using "/" as the point of split.

A nice bit of coding but isn't it rather unnecessary?

"list($discount, $fee) = explode( '/', vmText::_( 'COM_VIRTUEMART_PLUGIN_COST_DISPLAY' ) );" should this not be set as two different lines.

$discount = vmText::_( 'COM_VIRTUEMART_PLUGIN_COST_DISPLAY_DISCOUNT' );
$fee = vmText::_( 'COM_VIRTUEMART_PLUGIN_COST_DISPLAY_FEE' );

Then admins would be able to find the correct language override in search.

Just a thought, there may be other reasons you have used it this way, but at the moment it is not easy to change for the basic user