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./
How Can I get value from Dimensions type
- angelpeace
- Forum Members

- Posts: 39
- Joined: Fri May 15, 2009 9:45 am
-
calguy1000
- Support Guru

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: How Can I get value from Dimensions type
{$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.
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

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: How Can I get value from Dimensions type
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.
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
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.
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
$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] => Arrayso {$entry->fields.Dimensions} will return that element
Code: Select all
[Dimensions] => stdClass ObjectOne of the members of the Dimensions object is 'value'. so {$entry->fields.Dimensions->value} will return that member.
Code: Select all
[value] => ArrayOne 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.
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.
- angelpeace
- Forum Members

- Posts: 39
- Joined: Fri May 15, 2009 9:45 am
Re: How Can I get value from Dimensions type
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}
{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}
- angelpeace
- Forum Members

- Posts: 39
- Joined: Fri May 15, 2009 9:45 am
Re: How Can I get value from Dimensions type
Hey Calguy,
I want to know Two type defination on Products: Subcriptions & Quantity on hand;
For example?? I don't use.
I want to know Two type defination on Products: Subcriptions & Quantity on hand;
For example?? I don't use.
