Page 1 of 1
[SOLVED (yipee)] call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 6:31 pm
by jezatron
Hi.
I'm convinced this is probably really easy, but after a lot of trial and error Im having to admit defeat and ask for help.
The default sample summary for products calls all the custom fields in one lump.
How can I just call for the value of one of them?
I have tried lots of different variations looking at what things i can find with the power of google... but can't actually get it to call the field value individually in my summary at all.
Im using CMSMS 1.5.4 Carolina and Products 2.3.1 if it makes a diff.
I will be eternally grateful if anyone can help. Thanks
Re: call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 6:36 pm
by JeremyBASS
well you could go IIRC
Code: Select all
{foreach from=$items item=entry}
{foreach from=$entry->fields key='name' item='field'}
{if $name=='theName'}
{$field->value}
{/if}
{/foreach}
{/foreach}
That's just one way and I think you may-be able to go directly like {$items->fields->Thename.value} or something like that.. I'd have to look... Hope that helps...
Cheers
Jeremy
Re: call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 7:09 pm
by JeremyBASS
calguy1000 informed me it is... $entry->fields.FIELDNAME->value

so that should do it...
Cheers
Jeremy
Re: call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 7:18 pm
by jmcgin51
jezatron wrote:
Im using CMSMS 1.5.4 Carolina and Products 2.3.1 if it makes a diff.
You need to update to CMSMS 1.6.4. Prior versions are not supported, and in this case pose a potential security risk.
Re: call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 7:23 pm
by inyerface
I'm not sure how to explain the logic but here's an example below:
Assume you create a custom field "SKU" for your products. Display it using the following code (The custom field is case sensitive)
But what if you don't have a SKU for your product... use this
Code: Select all
{if $entry->fields.SKU->value ne ''}
SKU: {$entry->fields.SKU->value}
{/if}
So while I'm here I may as well provide some information on using the custom fiel "Image". We use this to add an image of our Product. The following will display the thumbnail that is generated (you can change the size of the thumbnail in "Calguys Module Extensions"). The image will link to Product Details (detail template)
Code: Select all
{if $entry->fields.Image->thumbnail ne ''}
<a href="{$entry->detail_url}"><img src="{$entry->file_location}/{$entry->fields.Image->thumbnail}" alt="" /></a>
{/if}
And in the detail tmeplate, we want to show the thumbnail again but when it's clicked we want the ful size photo to open in a new window
Code: Select all
{if $entry->fields.Image->thumbnail ne ''}
<a href="{$entry->file_location}/{$entry->fields.image->value}" target="_blank">
<img src="{$entry->file_location}/{$entry->fields.image->thumbnail}" alt="" />
<div class="zoom">Enlarge this photo</div>
</a>
{/if}
Ad that's it. I'd also recommend that you use the following in your template to see all the $entry variables available to you
I hope this helps
Re: call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 7:28 pm
by jezatron
Wow Jeremy (/Calguy) and Inyerface. Really appreciate the super-quick response.
Thanks I have searched for this but couldn't find anything and was getting desperate. Ill try implementing this in a second.
Re: call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 7:32 pm
by jezatron
jmcgin51 wrote:
jezatron wrote:
Im using CMSMS 1.5.4 Carolina and Products 2.3.1 if it makes a diff.
You need to update to CMSMS 1.6.4. Prior versions are not supported, and in this case pose a potential security risk.
Oh dear. That's a bit of a worry.
When I first started building this site and finally started making headway I saw they realised a new version of CMSMS but that people were having problems with it. I thought better to crack on on the stable version instead... maybe I was wrong. This is my first CMSMS site.
Is the process of updating from 1.5.4 to 1.6.4 very difficult? I have just pretty much finally got to the end of this site and it feels like it has been going forever! I have learned a lot along the way and feel a lot more comfortable with CMSMS than I did at the start, but obviously there are still some fairly big holes in my knowledge / understanding as I am a designer really.
Thanks again all of you for your advice.
Re: call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 7:42 pm
by inyerface
The upgrade will go fine. I have done the 1.5.4 to 1.6.4 about 15 times now and it went great!!
No problems for me on 1.6 series... just works really well!
Re: call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 9:26 pm
by jezatron
inyerface wrote:
The upgrade will go fine. I have done the 1.5.4 to 1.6.4 about 15 times now and it went great!!
No problems for me on 1.6 series... just works really well!
do you just click 'update cmsms' somewhere or something or do you have to go and do mysql manual backups and stuff? just cos i know nothing lol.
Re: call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 9:28 pm
by jezatron
the field call worked by the way thanks
I feel a bit more liberated when it comes to templating now. the next site i will just write the templates for product details and summary from scratch. i did that with the site pages but was different with these as i found it harder to work out.
Re: [SOLVED (yipee)] call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 9:30 pm
by JeremyBASS
jezatron wrote:
the field call worked by the way thanks
I feel a bit more liberated when it comes to templating now. the next site i will just write the templates for product details and summary from scratch. i did that with the site pages but was different with these as i found it harder to work out.
That's great,
don't forget to mark [solved] ha you did it as I typed Cheers to you
Have a great one today...
Cheers
Jeremy
Re: [SOLVED (yipee)] call 1 field in product view - Calguys Products
Posted: Thu Aug 27, 2009 9:40 pm
by jezatron
thanks jeremy