[ SOLVED ] Custom Fields plugin does save to database and have incorrect values

Started by cimeran, April 05, 2013, 22:11:42 PM

Previous topic - Next topic

cimeran

VM 2.0.12f
Joomla 2.5.7

I'm adding a custom field of type "Plugins - Customer text input". I add it to a product and when I add that product to the cart:

1.) The value is present in the product's custom fields, but it is not what I entered...the value is "textinput"
2.) The custom field is not saved into the database.

I know many questions have been asked about this, but I'm kind of tearing my hair out trying to figure out why I can't just save some text along with a product. ANY guidance would be much appreciated!

Custom Field:
Published: Yes
Cart Attribute: Yes
Admin only: No
Is a list: No
Hidden: No
Price per input = 0

In "templates.../cart/default_pricelist.php" I do this:

<?php if(count($prow->customFieldsCart) > 0){ ?>
  <?php foreach ($prow->customFieldsCart as $key => $field) { ?>
    <tr>
      <td colspan="4"><?php print_r($field); ?></td>
    </tr>                     
  <?php } ?>
<?php } ?>

...which outputs this:

stdClass Object
(
    [virtuemart_custom_id] => 27
    [custom_title] => To
    [custom_value] => textinput
    [custom_field_desc] => Need a gift enclosure?
    [custom_tip] => giftenc
    [field_type] => E
    [virtuemart_customfield_id] => 396
    [is_hidden] => 0
    [options] => Array
        (
            [396] => stdClass Object
                (
                    [virtuemart_product_id] => 157
                    [custom_params] => custom_size="100"|custom_price_by_letter="1"|
                    [custom_element] => textinput
                    [virtuemart_custom_id] => 27
                    [virtuemart_customfield_id] => 396
                    [custom_value] => textinput
                    [custom_price] => 0.00000
                    [custom_param] => {"custom_size":"50"}
                    [text] => textinput No additional charge
                    [value] => 396
                    [custom_size] => 100
                    [custom_price_by_letter] => 1
                )

        )

    [display] =>
   <input class="vmcustom-textinput" type="text" value="" size="50" name="customPlugin[396][textinput][comment]"><br />
<input type="hidden" value="396" name="customPrice[0][27]" /> <div class="price-plugin">Price: <span class="price-plugin">No additional charge</span></div>
)

K&K media production

update vm to 2.0.20b ... also adapt your template overrides to 2.0.20b (available layout changes files for 2.0.14 and 2.0.16)

http://dev.virtuemart.net/attachments/download/520/com_virtuemart.2.0.14_layout_changes.zip
http://dev.virtuemart.net/attachments/download/544/virtuemart_2.0.14_to_2.0.16_layout_changes.zip

if you have updated to 2.0.12 and you don't have adapt your overrides you need also the other layout changes

download:
http://dev.virtuemart.net/projects/virtuemart/files

then try it again

cimeran

Upgraded to the latest versions and did all the override changes necessary.

The text fields still aren't saving into the database and the value is still "textinput".

Any other ideas, all?

K&K media production

I can't reproduce this issue. The correct comment value is visible in cart and is stored in DB (#__virtuemart_order_items -> product_attribute).

cimeran

SOLVED.

Turns out it was my template override that was the culprit. I still find it all a bit confusing, but at least the data is there (albeit in an odd format).

Carmine