• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Trying to add "Adding a viewed product history"

Engaged ,
Jul 28, 2015 Jul 28, 2015

Copy link to clipboard

Copied

I'm trying to add the viewed product history http://docs.businesscatalyst.com/user-manual/e-Commerce/Products/adding-a-viewed-product-history

but I get errors in the code when I place:

{% if globals.cookie.lastVisited %}
{% assign prodIds = globals.cookie.lastVisited | append: "]" | prepend: "[" | split: "%2C" | join: "," %}
{module_data resource="products" version="v3" fields="canonicalUrl, name, smallImage" where="\{'id':\{'$in': {{prodIds}} \}\}" collection="lastProducts" template=""}
<h4>Your last visited products:</h4>
<ul>
   {% for item in lastProducts.items %}
   <li><a alt="{{item.name}}" href="{{item.canonicalUrl}}"><img alt="{{item.name}}" src="{{item.smallImage}}?Action=thumbnail&Width=50&Height=50"/></a></li>  
   {% endfor %}
</ul>
{% endif %}


Any help would be appreciated.

TOPICS
eCommerce

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Nov 19, 2015 Nov 19, 2015

OK It looks like I made it after 1000x times attempts the structure is as follow:

STEP 1: create your main template for the pages:

Main Template>

Insert the libraries as follow:

1- Jquery latest (for me working on jQuery v1.11.1)

2 - Jquery.cookies

Inside the container you have your {tag_pagecontent} just past the liquid code provided:

<section>

<div class="main-description">{tag_pagecontent}</div>

<div class="rencet-viewd">

{% if globals.cookie.lastVisited %}

{% assign prodIds = globals.cookie.lastVisited

...

Votes

Translate

Translate
LEGEND ,
Jul 28, 2015 Jul 28, 2015

Copy link to clipboard

Copied

Hi there,

You need at least a link or more information about the errors.

Did you include jquery, did you include the jquery cookie plugin? Is it a javascript error or a display/liquid error.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 28, 2015 Jul 28, 2015

Copy link to clipboard

Copied

I followed the instructions and tested liquid was activated. When I add that rendering code, the BC page would not save and the editor would not change to visual mode from code mode. Is there a specific wrapper that needs to go around that section of code?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 28, 2015 Jul 28, 2015

Copy link to clipboard

Copied

You have to make sure you paste code like this in html mode.

Because you have liquid in there it will never go back to visual editing mode as this can break that code.

You should not really be editing and changing layouts/templates using that visual editor - it is not built for that.

You still not properly indicated the issue Adam.

The code just showing not rendering, it does not work?

You not answered my question about installing the javascript elements to this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 29, 2015 Jul 29, 2015

Copy link to clipboard

Copied

I am pasting the code in html mode. Here is the site URL: Alessi

Be aware that all menu links take you to the original site as this is a duplicate.

IPL.png

OL.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 29, 2015 Jul 29, 2015

Copy link to clipboard

Copied

You really need to provide a link

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 29, 2015 Jul 29, 2015

Copy link to clipboard

Copied

http://bradshaws-responsive.businesscatalyst.com/alessi

Product history should appear below the products.

Please be aware that all main menu links go to original site.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 29, 2015 Jul 29, 2015

Copy link to clipboard

Copied

You need to fix your javascript errors and address your conflicts, like loading jQuery multiple times doing different syntax.

Copy pasing code from a doc will not just work in most cases as they are only examples to implement in the environment (site) you have..

View your console on the detail page of a product and you will see the errors to address:

Screenshot 2015-07-30 14.20.30.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 04, 2015 Aug 04, 2015

Copy link to clipboard

Copied

Hi I'm still looking for any assistance on how to actually implement this feature as the BC Doc is does not provide enough info.

What are the steps to add this feature to a web page that are missing from the user manual document: Adding a viewed product history

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 04, 2015 Aug 04, 2015

Copy link to clipboard

Copied

You do not even have anything set up code wise now Adam.

- You need liquid enabled on your site

- You need to have jquery installed on the site and if it is already in the code do not call it again and the cookie plugin

- You need to include the main script being called (if in separate js file) on the detail view of a product or on a detail view of the product

- Step 2 liquid code needs to go in the template/shop layout location you need it to render

You need to ensure no errors and understand your doing Javascript, have enough understanding to follow what is going on and the liquid in place and know what it is rendering. You will then need to style it with CSS.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 04, 2015 Aug 04, 2015

Copy link to clipboard

Copied

Please see post #4 screen shots

- You need liquid enabled on your site - Done

- You need to have jquery installed on the site and if it is already in the code do not call it again and the cookie plugin - Done

- You need to include the main script being called (if in separate js file) on the detail view of a product or on a detail view of the product - Done

- Step 2 liquid code needs to go in the template/shop layout location you need it to render - Done

"have enough understanding to follow what is going on and the liquid in place and know what it is rendering" - If I did I wouldn't be on the forum looking for help!


Liam, have you installed this feature before? If so what are the steps missing from the document?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 04, 2015 Aug 04, 2015

Copy link to clipboard

Copied

Your saying your done, but I can not find the javascript code running on the product detail view on your site and nor do I see jquery cookie plugin running, I do not see a block in the other layouts for the liquid and there are no script errors but there are also no cookie events firing off because the code is not there.

You need to understand this is not a plugin or anything, just a copy paste anywhere will not make this work.

Right now, I do not see the code on the site like the Javascript that needs to be there for this to work.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 04, 2015 Aug 04, 2015

Copy link to clipboard

Copied

I had taken it out since I was not getting anywhere with it.

The code has been put back in to match the screen shots.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 04, 2015 Aug 04, 2015

Copy link to clipboard

Copied

The way Muse is generating the jQuery it has two instances of it through a document.write method. The latter loaded jQuery as it is loaded last into memory always takes over. This is at the bottom so if you look at the console you can see two errors.

1. Your cookie plugin can not find jquery - Put it at the bottom after the script code Muse is making

2. the javascript you pasted at the top can not find jQuery so this needs to be after as well at the bottom.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 16, 2015 Nov 16, 2015

Copy link to clipboard

Copied

Hey guys, I can see this is getting a bit frustrating for me too, I have put the snippets and made a few corrections as the script given does not the calls as variable I am not sure why but it works but for some reason but the Cookies plugin is not working properly on my site I don't have a single error on my log, but it either is not storing information or fetching the products data, did you have any error with jquery.cookies I am struggling with it as a few functionalities I built to work with BC never worked successfully.

My site is www.bestkilts.com

Thanks for the help if I get any 😜

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

Hi Ricardo - where did you put the code at step 1? I couldn't find it in the Large product layout.

Thanks,

Mihai

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

the code is on /MASTER-SHOP.js on the last lines of the script, use your developer's provided tab to access it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

So did you get this working then?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

No errors on the console and either the script but the Liquid is not outputting  a thing so I presume the liquid has something wrong, or something beyond my understanding.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

Hi Ricardo,

Please take the script out of the script and put it inline on the Large product layout. The problem is if you take it out of context the IDs and other Liquid tags won't work.

Adam, let me have a quick description of your setup and I'll have a look.

Thanks,

Mihai

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

I tried it and I don't know but maybe because I use a template to generate the large product I end up having a small render rather than the large view I use the line: {module_product,297600,{tag_productid} template="/ModuleTemplates/Ecom/{tag_custom1}.tpl"}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

I don't think that matters, just put the code at the end of the large product layout.

{module_product,297600,{tag_productid} template="/ModuleTemplates/Ecom/{tag_custom1}.tpl"} will render this bit https://monosnap.com/file/4pupm1YXqrPHY9Au5yhIz4PL5cDzxB.png

Everything you add after that will render below. It is there where you would need to add the script that saves the cookie (step 1 of the guide).

Hope this helps,

Mihai

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

Hi Mihai, I added the code to the large product layout here: Stonewall Kitchen Jam Tree

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

We clearly need a new tutorial for implementing this awesome feature. Could someone put that together? Most appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

Your page has 9 errors/conflicts you need to fix them in order to have whatever you want to work actually "work"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines