Author Topic: Why is html saved for shipment and payment in db  (Read 1843 times)

Rune Rasmussen

  • Jr. Member
  • **
  • Posts: 195
  • Is the stable release stable?
    • SYNTAX ERROR
  • VirtueMart Version: Latest ;)
Why is html saved for shipment and payment in db
« 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.
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10530
  • VM4.0.7 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Why is html saved for shipment and payment in db
« Reply #1 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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10530
  • VM4.0.7 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Why is html saved for shipment and payment in db
« Reply #2 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).
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Rune Rasmussen

  • Jr. Member
  • **
  • Posts: 195
  • Is the stable release stable?
    • SYNTAX ERROR
  • VirtueMart Version: Latest ;)
Re: Why is html saved for shipment and payment in db
« Reply #3 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:

Code: [Select]
<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:
Code: [Select]
<span class="vmshipment_name">Self pick-up</span>
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

alatak

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2048
    • alatak.net
Re: Why is html saved for shipment and payment in db
« Reply #4 on: September 22, 2015, 10:39:46 am »
hello
Quote
There 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.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10530
  • VM4.0.7 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Why is html saved for shipment and payment in db
« Reply #5 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
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Rune Rasmussen

  • Jr. Member
  • **
  • Posts: 195
  • Is the stable release stable?
    • SYNTAX ERROR
  • VirtueMart Version: Latest ;)
Re: Why is html saved for shipment and payment in db
« Reply #6 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.
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

Rune Rasmussen

  • Jr. Member
  • **
  • Posts: 195
  • Is the stable release stable?
    • SYNTAX ERROR
  • VirtueMart Version: Latest ;)
Re: Why is html saved for shipment and payment in db
« Reply #7 on: October 01, 2015, 23:25:21 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
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team