Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hello! I started using Couch quite recently but I like it more and more.
I'm glad that I found you and I'm glad that you are!! :D

Now I want to make online store using Couch Shopping Cart. I have a question: is it possible to realize the comparison of products?
Is it difficult? Where to begin?

I will be glad to any opinion!
Sorry for my english.. :oops:
Hello,

In my view, you'd need only presentation html markup.
Unless you see comparison differently, it looks as there are same links: add-to cart and remove-from-cart.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Hi Jiwa :)

We can use specify 'id' or 'page_name' parameters with cms:pages tag to fetch any particular single page.

We can also use the cms:pages tag multiple times (twice in our case) on the same page to fetch and show different pages on the same screen.

So there we have our comparison - we just need to show multiple pages (products) side-by-side on the same page.

We now only have to decide how to pass the ids or names of the pages to be displayed.
One easy way would be to use a separate uncloned template only for showing the comparision (say named 'compare.php').
From the main products page, we can invoke the above template passing it two querystring parameters representing the ids of the two pages to compare e.g.
http://yoursite.com/compare.php?product1=200&product2=400

On the compare.php template we retrieve the two ids and then use them in the two cms:pages block to show the two products side by side.

One way would be -
Code: Select all
<!-- get product1 ID -->
<cms:set my_productid_1="<cms:gpc method='get' var='product1' />"/>

<cms:if "<cms:not "<cms:validate my_productid_1 validator='non_zero_integer' />" />" >
    <cms:set my_productid_1= '0' />
</cms:if>

<!-- get product2 ID -->
<cms:set my_productid_2="<cms:gpc method='get' var='product2' />"/>

<cms:if "<cms:not "<cms:validate my_productid_2 validator='non_zero_integer' />" />" >
    <cms:set my_productid_2= '0' />
</cms:if>

<!-- compare the two products -->
<cms:pages masterpage='products.php' id=my_productid_1 limit='1'>
    <h2><cms:show k_page_title /></h2>
    ..
</cms:pages>

<cms:pages masterpage='products.php' id=my_productid_2 limit='1'>
    <h2><cms:show k_page_title /></h2>
    ..
</cms:pages

Hope it helps.
Thank you Trendoman and thank you KK!
Such a response - this is exactly what I expected!
A short guide in your style! :D
Now I try to use it a couple of days I will write about the results!
Unfortunately, I haven't built such a comparison yet. User experience matters a lot.

How to select 2 parameters to pass them - checkboxes? There's more questions than answers by going this way. Eventually, Jiwa wants to compare products, which can be more than 2. And use pagination on product listings, so AJAX cart solution really helps here. There are more to it besides what i mentioned briefly.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Hi,

I think the following topic http://www.couchcms.com/forum/viewtopic.php?f=8&t=7599 will get you going. I use it for a wishlist but has the same result as a compare function.
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
6 posts Page 1 of 1