[SOLVED (yipee)] call 1 field in product view - Calguys Products

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
jezatron
Forum Members
Forum Members
Posts: 63
Joined: Sun May 17, 2009 3:02 pm

[SOLVED (yipee)] call 1 field in product view - Calguys Products

Post 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
Last edited by jezatron on Thu Aug 27, 2009 9:29 pm, edited 1 time in total.
JeremyBASS

Re: call 1 field in product view - Calguys Products

Post 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
Last edited by JeremyBASS on Thu Aug 27, 2009 6:41 pm, edited 1 time in total.
JeremyBASS

Re: call 1 field in product view - Calguys Products

Post by JeremyBASS »

calguy1000 informed me it is... $entry->fields.FIELDNAME->value :D so that should do it...

Cheers
Jeremy
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: call 1 field in product view - Calguys Products

Post 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.
inyerface
Forum Members
Forum Members
Posts: 191
Joined: Mon Nov 26, 2007 4:46 pm

Re: call 1 field in product view - Calguys Products

Post 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)

Code: Select all


SKU: {$entry->fields.SKU->value}

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

Code: Select all


<pre>{$entry|print_r}</pre>

I hope this helps
jezatron
Forum Members
Forum Members
Posts: 63
Joined: Sun May 17, 2009 3:02 pm

Re: call 1 field in product view - Calguys Products

Post 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.
jezatron
Forum Members
Forum Members
Posts: 63
Joined: Sun May 17, 2009 3:02 pm

Re: call 1 field in product view - Calguys Products

Post 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.
inyerface
Forum Members
Forum Members
Posts: 191
Joined: Mon Nov 26, 2007 4:46 pm

Re: call 1 field in product view - Calguys Products

Post 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!
jezatron
Forum Members
Forum Members
Posts: 63
Joined: Sun May 17, 2009 3:02 pm

Re: call 1 field in product view - Calguys Products

Post 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.
jezatron
Forum Members
Forum Members
Posts: 63
Joined: Sun May 17, 2009 3:02 pm

Re: call 1 field in product view - Calguys Products

Post 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.
JeremyBASS

Re: [SOLVED (yipee)] call 1 field in product view - Calguys Products

Post 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 :D

Have a great one today...
Cheers
Jeremy
jezatron
Forum Members
Forum Members
Posts: 63
Joined: Sun May 17, 2009 3:02 pm

Re: [SOLVED (yipee)] call 1 field in product view - Calguys Products

Post by jezatron »

thanks jeremy
Post Reply

Return to “Modules/Add-Ons”