VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Rune Rasmussen on May 05, 2015, 14:40:40 PM

Title: Why is html saved for shipment and payment in db
Post by: Rune Rasmussen on May 05, 2015, 14:40:40 PM
I wonder why html (logos etc) is saved for shipment and payment options in the database for each order in the _virtuemart_payment_plg_NAME/_virtuemart_shipment_plg_NAME table, or rather - why it's used in different order views.

Why not just use the name as it's saved for each option in _virtuemart_paymentmethods_LANG_CODE/_virtuemart_shipmentmethods_LANG_CODE instead to give it all a cleaner normal look?

T.ex. on the Invoice pdf where it also is duplicated, making it look quite bad... I just don't get the idea behind this...

And yes... I know that some is able to modify it, both the display and the modules, but the system should be somewhat usefull for most people out of the box.

Attached is an image of a "worst case" scenario.
Title: Re: Why is html saved for shipment and payment in db
Post by: Milbo on September 14, 2015, 21:24:55 PM
There is the rule that an order should not be changeable afterwards. The safest method is just to store the html. I must digger deeper to understand all the reasons for it.
But I know the problem in general, maybe a special view for the invoices would be interesting.
Title: Re: Why is html saved for shipment and payment in db
Post by: Milbo on September 15, 2015, 19:21:50 PM
I think the problem is here that the name got misused as description. I wonder if the cart shows the description. So maybe the problem is there.
Example, use the name as name, the rest in the description. The invoice would have on top, the name and the list would be with description (as shown in the cart).
Title: Re: Why is html saved for shipment and payment in db
Post by: Rune Rasmussen on September 17, 2015, 22:43:48 PM
OK, I see. And I like the idea of a own view for invoices.

Anyhow part of the problem might be that few know about or use any description field, one reason for that might be that it's not used by core plugins neither - or do you remember any we can look at to learn from it?

T.ex. I just tested the latest version of VM with Klarna Checkout, and this is the result. In table 'virtuemart_payment_plg_klarnacheckout', under 'payment_name' this is stored:

<span class="vmpayment klarnacheckout">
      <span class="vmCartPaymentLogo" ><img src="https://cdn.klarna.com/1.0/shared/image/generic/badge/nb_no/checkout/short-blue.png?width=385" /></span>
          <span class="vmpayment_name">Klarnakasse</span>
   </span>


In table 'virtuemart_shipment_plg_weight_countries' under 'shipment_name' this is stored:
<span class="vmshipment_name">Self pick-up</span>
Title: Re: Why is html saved for shipment and payment in db
Post by: alatak on September 22, 2015, 10:39:46 AM
hello
QuoteThere is the rule that an order should not be changeable afterwards. The safest method is just to store the html.
Yes, it was the reason behind it.
Title: Re: Why is html saved for shipment and payment in db
Post by: Milbo on September 22, 2015, 15:27:10 PM
yeh but it was not meant to store parts of the template, it stores always a useless span. Just tricky to change that BC
Title: Re: Why is html saved for shipment and payment in db
Post by: Rune Rasmussen on September 24, 2015, 22:50:54 PM
Not only the span, but also the logo etc.  and it doesn't make any sense to save it in database, and even less to display it in mails and documents.

Store owners can not change the product name and price without any good reasons in most countries, that's right, but from there to saving unneeded stuff is quite a big difference Valérie.

But I guess the problem is that everything beneath the "main" span's for payment and shipment (e.g. <span class="vmpayment ...) in cart is saved now, instead of just the names.
Title: Re: Why is html saved for shipment and payment in db
Post by: Rune Rasmussen on October 01, 2015, 23:25:21 PM
Quote from: Milbo on September 15, 2015, 19:21:50 PM
I think the problem is here that the name got misused as description. I wonder if the cart shows the description. So maybe the problem is there.
Example, use the name as name, the rest in the description. The invoice would have on top, the name and the list would be with description (as shown in the cart).

And nope, see attached images. This is the standard payment and shipment plugins delivered and tested with VirtueMart 3.0.10