[Resolved] Simplified all-in-one product listing

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
Dramatic

[Resolved] Simplified all-in-one product listing

Post by Dramatic »

[Using Calguy1000's e-commerce modules]
I have a client with a total of seven products/services which fall under four hierarchy entries (single level). They would like everything to to be on one page, with the markup ending up something like:

Code: Select all

<h3>hierarchy name 1</h3>
<dl>
<dt><a href=product detail link>Product name 1</a></dt>
<dd>product summary 1</dd>
<dt><a href=product detail link>Product name 2</a></dt>
<dd>product summary 2</dd>
</dl>
<h3>hierarchy name 2</h3>
etc...
So far I've added a summary field to the products, and made a new hierarchy report template formatted as h3's and most other content removed. I figure that either there should be a call there to a product list template or just the smarty code for that template inserted directly, but I don't know what's necessary.
(note that all services are unpriced, as they're by quotation)

Can anyone point the way, or show me an example?
Last edited by Dramatic on Tue Jul 09, 2013 12:19 am, edited 1 time in total.
Dramatic

Re: Simplified all-in-one product listing

Post by Dramatic »

I have achieved what i'm after, but by using a terrible kludge because i can't figure the syntax for directly displaying the value of a specific custom field 'Product_Summary' : {$entry->???}
(Or as described in the template comments 'the summary template has access to custom fields via the $entry->fields hash')

In the meantime i've pinched code from the detail template which enumerates all custom fields and bunged an {if} into it. Ugh!
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Simplified all-in-one product listing

Post by Jo Morg »

Maybe this can help...
And this...
You may try {$entry->fields|print_r} or {$entry->fields|print_r} to see what is available on that particular template. :)
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Dramatic

Re: Simplified all-in-one product listing

Post by Dramatic »

Code: Select all

{$entry|print_r}
gives me

[fields] => Array ( [Product_Summary] => stdClass Object ( [id] => 1 [name] => Product_Summary [prompt] => Product Summary [type] => textarea [options] => Array ( [] => ) [max_length] => 255 [value] => An online, self-paced version of our starting a business course. [fielddef_id] => 1 ) )

{$entry->Product_Summary.value} ?
User avatar
webform
Power Poster
Power Poster
Posts: 524
Joined: Sat Nov 25, 2006 3:39 pm

Re: Simplified all-in-one product listing

Post by webform »

Try

Code: Select all

{$entry->fields.Product_Summary->value}
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Simplified all-in-one product listing

Post by calguy1000 »

$entry is an object. You access its elements with ->
[fields] => Array
means that 'fields' is an array. you access its elements with a . (or you could use a foreach)

i.e: {$entry->fields.SOMETHING}
[Product_Summary] => stdClass Object
means that Product_Summary is an object, you access its members/methods with a ->

i.e: Product_Summary->SOMETHING}

following that is a list of the members of Product_Summary which may in themselves be strings, integers, arrays, objects, etc. 'value' is a string, member of the Product_Summary object. so it doesn't need further digging.

Putting it all together:

{$entry->fields.Product_Summary->value} should give you what you want.
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.
Dramatic

Re: Simplified all-in-one product listing

Post by Dramatic »

Thanks - I need to do OOP 101 :)
Locked

Return to “Modules/Add-Ons”