News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Product Options Custom Field Dropbox Plugin (Updated)

Started by PRO, March 16, 2012, 11:52:11 AM

Previous topic - Next topic

drukman2000

Thanks.
I already tried s|=10,m|=20,b|=30 & it didn't work.
The relevant piece of info is on the next page:
http://www.csvimproved.com/index.php?option=com_content&view=article&id=778:custom-fields-import-and-export&catid=181
I am trying to import it with along many other product attributes so the relevany info starts from the second section "Using the Product import with custom fields".

Yet can you tell on that section which of the next 3 options is the correct one for this scenario of dropbox ?
1. "Custom fields with a single value"
2. "Custom fields with multiple values"
3. "Multiple custom values" (which is only supported on the pro version of csvi)

Thanks - Drukman.

PRO

it is a single value

the drop is stored as a single string

red,blue, green, etc

BUT! I have never got this to work.
It is possible, but I never have got it to work

drukman2000

Quote from: PRO on July 15, 2013, 00:28:53 AM
it is a single value
the drop is stored as a single string
red,blue, green, etc
BUT! I have never got this to work.
It is possible, but I never have got it to work
1. You wrote "BUT! I have never got this to work"...... - do you mean that you already tried CSVI with dropbox & it failed ?
2. If you tried it, may I ask what CSVI attributes you used ?
3. Have you noticed that there is a special attribute by the name "custom_param" ?

PRO

Quote from: drukman2000 on July 15, 2013, 04:29:58 AM
Quote from: PRO on July 15, 2013, 00:28:53 AM
it is a single value
the drop is stored as a single string
red,blue, green, etc
BUT! I have never got this to work.
It is possible, but I never have got it to work
1. You wrote "BUT! I have never got this to work"...... - do you mean that you already tried CSVI with dropbox & it failed ?
2. If you tried it, may I ask what CSVI attributes you used ?
3. Have you noticed that there is a special attribute by the name "custom_param" ?

I have not tried that much.
I dont remember how I tried to do it.

when I converted my site to 2.0. I uploaded the spreadsheet straight to the database


Maxim Pishnyak

It's not clear from your posts, drukman2000, is ~ text or field separator in your case.

It's more easy to export ONE product with dropbox custom field used.
And use that file, as csv example, form import file for other products.

Regards.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

drukman2000

Quote from: Maxim Pishnyak on July 15, 2013, 21:33:05 PM
It's not clear from your posts, drukman2000, is ~ text or field separator in your case.
It's more easy to export ONE product with dropbox custom field used.
And use that file, as csv example, form import file for other products.
Regards.
Custom field is imported but the selections are always empty.
When exporting custom_param data is very long & makes no sense.

Maxim Pishnyak

Quote from: drukman2000 on July 16, 2013, 05:48:32 AM
Custom field is imported but the selections are always empty. It's not clear what separators for texts and fields were used.
Don't get you.
Quote from: drukman2000 on July 16, 2013, 05:48:32 AM
When exporting custom_param data is very long & makes no sense.
If custom_param is that ones that could be really helpful in this, could you post here that nonsense?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

Maxim Pishnyak

Quote from: drukman2000 on July 16, 2013, 05:48:32 AM
Custom field is imported but the selections are always empty.
Don't get you. It's not clear what separators for texts and fields were used.
Quote from: drukman2000 on July 16, 2013, 05:48:32 AM
When exporting custom_param data is very long & makes no sense.
If custom_param is that ones that could be really helpful in this, could you post here that nonsense?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

strouve

hello, i use this great plugin, but i have a problem with it. when my customer choose a color t-shirt and order the product, the color option don't transmit to the final order and not to the email to!!! what can i do after, i can't know the color of t-shirt my customer choose !

PRO

Quote from: strouve on July 17, 2013, 17:19:08 PM
hello, i use this great plugin, but i have a problem with it. when my customer choose a color t-shirt and order the product, the color option don't transmit to the final order and not to the email to!!! what can i do after, i can't know the color of t-shirt my customer choose !

sounds like you have an old version of vmart or using outdated template overrides


aromasense

At first this plugin looked like the perfect solution for me..... but the

I have multiple prices for my products 1 price available for all and 1 price only for wholesale.

Can I use the dropbox separately for these 2 options?

this is my list 10ml|=10.48,30ml|=26.22,50ml|=37.35,100ml|=60.87 which shows up for all no problem but it also shows up for my wholesale shopper group overriding the wholesale price.

Any idea how to work around this?

Thanks for yoru help!

cheers
Marco

PRO

Quote from: aromasense on August 19, 2013, 01:54:18 AM
At first this plugin looked like the perfect solution for me..... but the

I have multiple prices for my products 1 price available for all and 1 price only for wholesale.

Can I use the dropbox separately for these 2 options?

this is my list 10ml|=10.48,30ml|=26.22,50ml|=37.35,100ml|=60.87 which shows up for all no problem but it also shows up for my wholesale shopper group overriding the wholesale price.

Any idea how to work around this?

Thanks for yoru help!

cheers
Marco


no

aromasense

Alright thought so but worat.

Now I started another thread but I am not sure it is related to this plugin?

http://forum.virtuemart.net/index.php?topic=118127.0

ahmadjan

Quote from: PRO on March 21, 2012, 12:18:29 PM
Quote from: Anik on March 21, 2012, 11:55:59 AM
Hello Banquet,

maybe i'm posting in wrong place but this is just to notify you. I was watching one of your tutorial http://www.kaizenmediaworks.com/virtuemart-template-and-module-control

I want to display some modules in some particular vm category. But where to paste those codes? Also do i need to create a new module to assign them (something like metamod)?

Any explanation will be helpful.

Thanks.

YOU put this code in your template wherever you want the module to show, and it will create a position for each category.

<?php if (JRequest::getVar('view')=='category') { ?>
<div id="catmod"><jdoc:include type="modules" name="category<?php echo JRequest::getInt('virtuemart_category_id',0); ?>" /></div>
<?php } ?>

The position is
category###
### is whatever category id you are on.
So if you go to a category, and the category id is 25.
It creates a position called category25


THEN, you go into modules, and you can type in
category25   in the position field. THEN, it will show up on that page.


Hi Super Hero You are a Real hero!!! I posted two questions about this thing.. Now It solves everything.. Thanks alot....
Best Regards....

AH

PRO

Firstly may I say what a great plugin!  A complete life saver!!

Please read to the end as I think offer a (significant IMHO) enhancement to the functionality

PRO may decide to adjust or implement such changes himself in the core 3d party plugin

Firstly let me explain my problem that this has helped (in part to resolve)

1. Store sells items by length/weight
2. Customers may want to purchase multiple different length/weights of the same item and have these "packed" or cut to spec

So, of course, the first thing I thought is to use the default QTY option

Customers want to buy 1 length of 8 feet, 1 length of 6 feet and 1 length of 3 feet AND have these items supplied cut to length, the default functionality fails to deliver

So this plugin appeared to give me what I wanted.  And wow! So easy

Option name = Length required feet
Option param = 1ft,2ft,3ft,4ft etc

Then just add the custom plugin to the product, OH NO

RTFM - you clearly state that :-


QuoteALSO: With updated version The custom field setup will not save with price variations. You have to do that in the individual product.


This could be done using sql or csvi but I wanted it to be more user friendly

I needed price modifiers to be stored by the plugin and retrieved when adding to the product.

The reason the prices are being "dumped" is the use of | as the price modifier delimiter

Solution to storing prices in the plugin

Change

$valueWithPrice = explode('|', $valuesWithPrice);

to


$valueWithPrice = explode('@', $valuesWithPrice);



Option param = 1ft,2ft@+20,3ft@+30,4ft@+40 etc

Price modfiers are now stored in admin and when the custom drop plugin is added to a product!

Next problem
We need the ability to make the dropdown price modifier a mutliplier
Each item sold by length has a different unit price and the length purchased is simply a multiple of the single unit price

Adding an dropdown option and an associated price as either, a value difference from the unit price or, a fixed value  does not work for our situation.

Solution to using a multiplier of the single unit price


public function plgVmCalculateCustomVariant($product, &$productCustomsPrice,$selected){
if ($productCustomsPrice->custom_element !==$this->_name) return ;
$customVariant = $this->getCustomVariant($product, $productCustomsPrice,$selected);
$this->parseCustomParams($productCustomsPrice);
$productCustomsPrice->custom_price = 0 ;
if ( isset ($customVariant['custom_drop'])) {
$options = explode(',', $productCustomsPrice->custom_drop);
foreach ($options as $valuesWithPrice) {
$valueWithPrice = explode('@', $valuesWithPrice);

if ( $customVariant['custom_drop'] == $valueWithPrice[0])  {
if ( isset ($valueWithPrice[1]) ) {

$op = $valueWithPrice[1][0];
                        switch ($op){
                            case "+":  $productCustomsPrice->custom_price =(float) substr($valueWithPrice[1], 1);
                                break;
                    case "=": $productCustomsPrice->custom_price = -$product->product_price+(float) substr($valueWithPrice[1], 1);
                                break;
                            case "-": $productCustomsPrice->custom_price = -(float) substr($valueWithPrice[1], 1);
                                break;
                            case "*": $productCustomsPrice->custom_price = - $product->product_price +($product->product_price*(substr($valueWithPrice[1], 1)));
                                break;
                            default: $productCustomsPrice->custom_price =(float) $valueWithPrice[1] ;
                            }
}
return ;
}

}
}





But the drop sees the multiplier as a currency value and display accordingly

So we need to strip the display of the currency value from the dropdown when it is a multiplier

function plgVmOnDisplayProductVariantFE($field,&$idx,&$group) {
// default return if it's not this plugin
if ($field->custom_element != $this->_name) return '';
$this->parseCustomParams($field);
$options = explode(',', $field->custom_drop);
$class='';
$selects= array();
if(!class_exists('CurrencyDisplay')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'currencydisplay.php');
$currency = CurrencyDisplay::getInstance();
foreach ($options as $valuesWithPrice) {
$valueWithPrice = explode('@', $valuesWithPrice);

if ( isset ($valueWithPrice[1]) ) {
$op = $valueWithPrice[1][0];
$price = substr($valueWithPrice[1], 1) ;
                $variant = substr($valueWithPrice[1], 0, 1) ;
if ($variant == "*") {
                    $text = $valueWithPrice[0] ;
                } else {
                    $text = $valueWithPrice[0].' ('.$op.$currency->priceDisplay((float)$price).')';
                }
} else {
$text = $valueWithPrice[0] ;
}
$selects[] = array('value' =>$valueWithPrice[0], 'text' => $text );
}
// vmdebug('plgVmOnDisplayProductVariantFE',$field,$idx,$group);
$html = JHTML::_('select.genericlist', $selects,'customPlugin['.$field->virtuemart_customfield_id.']['.$this->_name.'][custom_drop]','','value','text',$selects[0],false,true);
$group->display .= $html;
return true;
    }



So with a couple of tweaks the additional and changed functionality becomes something like this (below)

ALSO: With updated version
The custom field setup WILL save with price variations.
You can adjust this in an individual product.

Plugin Features:

    Apply A Template Of Options w/ 1 Click along with pricing adjustments
    Uses a Comma Separated List For Options
    Price Variant
    Also Accepts Negative Numbers for "minus"
    beta feature Equals and multiplier

Instructions:
Install The Plugin
Enable It
Go to custom fields.
Click "new"
Choose Plugins
The dropbox
Fill in the title.
Fill In the option template separated by Commas.
For example
Red,Blue,Green,Yellow
Red@+5,Blue@+7,Green@+3

Go To a Product Custom Fields.
Choose the plugin.
You will see all the options there already along with any price adjustments. You can just hit save.

You can change the template, and the specific product options without changing the products that already have them assigned to them.

For Price Variant just add @+ or @- at the end.
DO NOT PLACE AT THE FRONT
For example
Small,Medium @+5, Large @+10

For negative Just use
Large,Medium @-5,Small @-10

For Equals
Please Choose,Red@=100,Green@=200

For Mulitplier
1 feet,5 feet@*5,10 feet@*10


I have attached just the drop.php file all the other code remains as is.

[attachment cleanup by admin]
Regards
A

Joomla 3.10.11
php 8.0