Author Topic: Simple VM3 Product Cart Variant Custom Field / Attribute Plugin [ FREE ]  (Read 46252 times)

allamistakeo19

  • Beginner
  • *
  • Posts: 29
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #30 on: May 19, 2015, 23:01:15 pm »
Hi,

Thanks a lot for this plugin, it really addresses what I need (http://forum.virtuemart.net/index.php?topic=130001.msg447770#msg447770). 

One observation, though: is it multilingual? I need the title and contents of the drop box to be localized in English, French and Dutch in the frontend, depending on the language selected by the user. What would I need to do to achieve this?

Thanks in advance

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2562
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #31 on: May 20, 2015, 10:34:19 am »
regards
A

Joomla 3.7.2
php 5.6 + php 7

Studio 42

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2112
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #32 on: May 20, 2015, 14:12:24 pm »
Have you implement jtext for dropdown values?
Sorry i don't have the last release to test, but if not, then your trick does not translate the values.

allamistakeo19

  • Beginner
  • *
  • Posts: 29
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #33 on: May 20, 2015, 18:10:00 pm »
After giving it a try, I can confirm that just using language overrides does the job, with one (noticeable) exception: the strings in the drop-down list don't get overridden when they are followed by a price. I assume it should not be too much trouble to fix this in the code...?

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2562
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #34 on: May 20, 2015, 18:30:01 pm »
Hmm... so the language override works in the drop when no price is set?



regards
A

Joomla 3.7.2
php 5.6 + php 7

allamistakeo19

  • Beginner
  • *
  • Posts: 29
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #35 on: May 20, 2015, 18:34:51 pm »
Hmm... so the language override works in the drop when no price is set?

Yes, unless you apply the following patch, which I was able to figure out myself by looking at the (relatively simple) code. Then it also works when a price is set.

In plugins/vmcustom/drop/tmpl/default.php, replace the following line 20:

Code: [Select]
$text = $valueWithPrice[0].' ('.$op.$currency->priceDisplay((float)$price).')';

with:

Code: [Select]
$text = vmText::_($valueWithPrice[0]).' ('.$op.$currency->priceDisplay((float)$price).')';

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2562
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #36 on: May 20, 2015, 19:43:00 pm »
Quote
In plugins/vmcustom/drop/tmpl/default.php, replace the following line 20:

You would also need to change all instances of $valueWithPrice[0]

However it is not as simple as that one line  :'(

The default.php does not effect the cart data - which if you look, is not translated.
regards
A

Joomla 3.7.2
php 5.6 + php 7

Studio 42

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2112
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #37 on: May 20, 2015, 22:25:32 pm »
I think, you have to explode all lines and convert with JText the string. Because the standard Options use the full line.
It's what i mean with "you have implement jtext for values".

allamistakeo19

  • Beginner
  • *
  • Posts: 29
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #38 on: May 21, 2015, 07:28:53 am »
The default.php does not effect the cart data - which if you look, is not translated.

Indeed, I was a bit too fast at testing. But it turns out that fixing the display in the cart is just another single line to replace, this time in plugins/vmcustom/drop/drop.php. The following line:
Code: [Select]
$html .='<span>'.vmText::_($productCustom->custom_title).' '.$item['custom_drop'].'</span>';should become:
Code: [Select]
$html .='<span>'.vmText::_($productCustom->custom_title).': '.vmText::_($item['custom_drop']).'</span>';
I still haven't tested any further than the display in the cart, so there may be some remaining issues.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2562
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #39 on: May 21, 2015, 09:31:40 am »
Thanks for the feedback

I will see what I can do to the plugin to put vmText into the base version - no promises though  ;)

regards
A

Joomla 3.7.2
php 5.6 + php 7

allamistakeo19

  • Beginner
  • *
  • Posts: 29
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #40 on: May 21, 2015, 18:54:22 pm »
I still haven't tested any further than the display in the cart, so there may be some remaining issues.

The invoice correctly includes the translated strings.
The strings still don't get translated in the backend when you display the order, but personally I can live with that, so I'm going to leave it at that, and let Hutson eventually provide an official, more complete solution than the two quick patches I came up with.

thouniii

  • Beginner
  • *
  • Posts: 1
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #41 on: May 28, 2015, 11:46:17 am »
Is it possible to update from version 2 to 3.06? Now when I update the plug in, the prices disappear.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2562
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #42 on: May 29, 2015, 19:45:37 pm »
This is a new version and is not an "upgrade"

Your old settings and configurations are not carried over to the new plugin.
regards
A

Joomla 3.7.2
php 5.6 + php 7

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10275
  • VirtueMart Version: 3+
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #43 on: June 04, 2015, 21:45:32 pm »
This is a new version and is not an "upgrade"

Your old settings and configurations are not carried over to the new plugin.

The old version

Had 2 parameters stored in the database.

Custom Name, and the dropstring

Like so
custom_drop_name="Color"|custom_drop="Choose Color,Arizona, Autumn, Black, Brushed Silver, Dark Mahogany, Light Oak, Light Stone, Maple, Stone, Teak"|

BUT! The new version has it stored

custom_drop="Choose Color,Arizona, Autumn, Black, Brushed Silver, Dark Mahogany, Light Oak, Light Stone, Maple, Stone, Teak"|


for the old customs to work with the new dropbox,
you have to remove  EVERYTHING BEFORE    custom_drop=


FOR ME, THIS FIXED ALL OF THE CUSTOMS,
Mysql
UPDATE `xxx_virtuemart_product_customfields` SET `customfield_params` = SUBSTRING_INDEX(`customfield_params`,'|',-2);

AS WELL AS WHATS POSTED HERE.
https://forum.virtuemart.net/index.php?topic=127362.msg436581#msg436581

BACKUP BEFORE USING THE CODE ABOVE
I do NOT do development work for hire.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2562
  • VirtueMart Version: 3.2.3
Re: VM3 Product Options Custom Field Dropbox Plugin
« Reply #44 on: June 05, 2015, 10:53:04 am »
Great explanation for old version users

The field

custom_drop_name

Is now taken from the plugin instance name

I did this to allow a change of name at the plugin level to affect all product instances
regards
A

Joomla 3.7.2
php 5.6 + php 7