How Can I get value from Dimensions type

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
angelpeace
Forum Members
Forum Members
Posts: 39
Joined: Fri May 15, 2009 9:45 am

How Can I get value from Dimensions type

Post by angelpeace »

In this Products Detail Template
I have:
....
[fields] => Array
(
[Dimensions] => stdClass Object
(
[id] => 9
[name] => Dimensions
[prompt] => Dimensions
[type] => dimensions
[options] => Array
(
[] =>
)

[max_length] => 255
[value] => Array
(
[length] => 27
[width] => 17
[height] => 28
)

[fielddef_id] => 9
)
...
Get length or width or height????
Help me./
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: How Can I get value from Dimensions type

Post by calguy1000 »

{$fields.Dimensions->value.length}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: How Can I get value from Dimensions type

Post by calguy1000 »

Here's the lesson:

$entry is an object. You access its elements with the -> operator. One of those members is 'fields' {$entry->fields} will return that member.

Code: Select all

[fields] => Array
means that the field member itself is an array. that you access its elements with the . or [] operators (see the smarty manual). One of those members is 'Dimensions'
so {$entry->fields.Dimensions} will return that element

Code: Select all

[Dimensions] => stdClass Object
means that the Dimensions element is itself an object. You access it's members with ->

One of the members of the Dimensions object is 'value'. so {$entry->fields.Dimensions->value} will return that member.

Code: Select all

[value] => Array
means that the value member of the Dimensions object is itself an array. Again, you access the array elements with . or [] operators.

One of the elements of the Value array is 'length'.
so {$entry->fields.Dimensions->value.length} will return that element
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
angelpeace
Forum Members
Forum Members
Posts: 39
Joined: Fri May 15, 2009 9:45 am

Re: How Can I get value from Dimensions type

Post by angelpeace »

Thanks,

{if ($field->type == 'dimensions')}
{assign var="length" value=$field->value.length}
{assign var="width" value=$field->value.width}
{assign var="height" value=$field->value.height}
{/if}
User avatar
angelpeace
Forum Members
Forum Members
Posts: 39
Joined: Fri May 15, 2009 9:45 am

Re: How Can I get value from Dimensions type

Post by angelpeace »

Hey Calguy,
I want to know Two type defination on Products: Subcriptions & Quantity on hand;
For example?? I don't use.
Post Reply

Return to “Modules/Add-Ons”