News:

Looking for documentation? Take a look on our wiki

Main Menu

[SOLVED] Access to / Display of - individual custom fields

Started by status101, June 01, 2012, 19:02:43 PM

Previous topic - Next topic

status101

Hi There,

Firstly, if this has been covered before I apologise.  I have searched the forums and have not been able to find an answer ( although think I have gotten close ) and need a little help.

I am using Joomla 2.5.4 and VM 2.0.2 ( Tried to update about 5 time and never managed to make it happen but will tackle that later )

(Very) Basically I am trying to A) display an individual custom field on the product page, and B) Call a custom .php file based on a value from a hidden custom field.

I have managed to add custom fields, create a hidden custom hidden field with selectable options and disply my normal custom fields (by group and positions) in tabs on the product page.

I have a "basic" understanding of the general php required to do the display / if, thens / calls to do what I want but I cannot work out how to 'access' the custom fields.

I have seen posts from BanquetTables.pro with code like :

<?php echo $product->product_name ?>

and


<?php if ($this->product->product_weight == 0) { ?>
        <div>Free Shipping on this Item! Minimum Order Quantity <?php echo $this->product->min_order_level ?></div>
<?php    }?>


This gives me ( along with the very helpful post - http://forum.virtuemart.net/index.php?topic=92756.0 ) an understanding of how to access most of the standard product fields I might need, but can anyone please help me / point me in the right direction as to how I might access my custom fields in a similar way?

I have looked through myphpadmin for a possible field "name" but as I can only really see ID's and display names, I think (know) I am missing something somewhere.

If I have failed to explain what I am trying to do, or am flat out not making sense.... please let me know and I will try to elaborate.

Many thanks in advance for any advice, links etc.

Regards

Michael Tull

status101

Hi there again everyone / anyone....

75 reads at this stage and no ideas...  Maybe I have over complicated things.. What I am actually trying to is, I have a range of products that have different warranty options.  I have created tabs on the product page, one of which will hold the warranty information.

I would like to have a drop down / selection option for the warranty period for each product during product detail entry, so the admin / backend user can select 1 year / 2 year / 3 year etc.

As my post above describes, I have created a custom field, editable when entering a product, and was trying to work out how to access the value of this field to load some custom code based on the value.

If the way I am looking to do this is just plain wrong, I would appreciate any pointers to how I might look at doing this.  I would have through having variable warranty details would be a fairly basic requirement for many types of online stores.

Many thanks in advance

Michael Tull

Marba917

Hello my friend!

did you resolve this? i am looking for the same thing, i need the code to get a custom field from a product.

something like:  $var1= $product->custom_field('customfield1');

please help


thanks

vigier

I'm also interested in this. Have been searching through code and this forum, but never figured it out :(

status101

Hi again,

Obviously there are a few people wanting to know the same thing, but there seems to be no one around that can help with it.  I still have not been able to work this one out which is really frustrating, and extremely limiting for customizing the output of Virtuemart.

If I am asking the wrong question, using the wrong terminology.... or am missing the point all together.... please is there anyone out there that can point me ( us ) in the right direction at least.

I am more than capable of doing this in other systems ( such as K2 ) where I read the fields into an array, and then have access to them by ID... surely this is possible to do in Virtuemart as well?????

Any assistance would be greatly appreciated.

bytelord

Hello,

If you search the forum this one have been answered many times. An example i remember is here: http://forum.virtuemart.net/index.php?topic=105563.msg369432#msg369432

Try to find more under Product creation Section: http://forum.virtuemart.net/index.php?topic=99225.0

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

status101

Hi bytelord, and thank you for posting back to me.  I did actually search the forum but sometimes these things can get difficult if you are not familiar with even the correct terminology used by a particular community.

As an example by just looking at the link you posted, I now understand ( and have ) searched for ">customfields" ... this game me reverent results! :) where as "custom fields" game a lot of what I didn't want to know, which is why the request for even terminology.

So THANK YOU! :) for taking the time to post the links... It has pointed me in the right direction and hopefully as I read more and learn the terminology I will have less silly questions.

Thanks again.


bytelord

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!