Developer forum

Forum » Templates » Access to Ecom properties from a paragraph

Access to Ecom properties from a paragraph

Martin Kure
Reply

Hi all, 

I have a site running with a shop. In the master.html of the site, I've included a global.paragraph written in razor. The paragraph is just an extra cart of sort, displaying product price etc. I have included the paragraph, because it's written in razor and the master is written in html. With this work-around, the razor part gets rendered server-side. So far, so good. 

<div class="col-lg-12 col-md-12 col-sm-12">
      <!--@Global:Paragraph.Content(4058)-->
</div>

However, in the paragraph, I can't access the Ecom-class. I would like to retrieve the following properties:

Ecom:Order.OrderLines.TotalProductQuantity

Ecom:Order:OrderLine.ProductLink

Ecom:Order:OrderLine.ProductName

Sadly, these properties seems not to be available from my paragraph.

Is there a way to make the Ecom-properties available from a paragraph.

 

/BR

Martin


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Martin

In your master template, you should use the cart tags available there instead of including a paragraph with the cart module. It will give you only problems - i.e. on the page where you have the actual cart etc.

All the same tags are available in both the paragraph and the master template:

http://templates.dynamicweb.com/eCommerce/Dynamicweb-eCommerce-template-tags/Shopping-Cart-V2/Order/Cart.aspx

It is the same renderer.

 
Martin Kure
Reply

Hi Nicolai, 

I'm not including a paragraph with an extra cart. I'm simply adding a paragraph, that uses some of the ecom-tags. However, I don't get any values from the properties, when I'm using them in a paragraph imported globally to the master templater.

Thank you for feedback.

 
Nicolai Høeg Pedersen
Reply

Hi Martin

I think I need a link to see what is going on. It should be very simple, so will have to take a look.

BR Nicolai

 
Martin Kure
Reply

Hi Nicolai, 

thank you for getting back to me.

It's the top cart-part from DWSimple that I'm trying to duplicate. It's all the razor-ecom-tags, that are not being rendered. Here's a link to the site, where you can see the cart-icon at the top of the page.

http://demo.soegaard-co.dk/Default.aspx?ID=5579.

Here's the code I've written in the master.html:

<div class="row">
   <div class="col-lg-12 col-md-12 col-sm-12">
         !--@Global:Paragraph.Content(4058)-->     
   </div>

</div>

And here's the razor-code:

    @Include("../eCom7/CartV2/MiniCart.cshtml")

    @{
    var cartid = GetValue("DwAreaCartPageID"); 
        <div class="top-header">
            <div class="top-header-menu hidden-sm hidden-xs">
                <ul class="top-menu">
                    <li class="dropdown animate-hover" data-animate="animated fadeInUp">
                        <a href="Default.aspx?ID=@cartid" title="" id="minipagecart" class="dw-minicart"><i class="fa fa-shopping-cart"></i> @GetValue("Ecom:Order.OrderLines.TotalProductQuantity") <span>@GetValue("Ecom:Order.OrderLines.Total.PriceWithVAT")</span></a>

                        <ul class="sub-menu">
                            <li id="minicart">
                                @MiniCart()
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>            
    }

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hm.

So you have a master template that includes a paragraph that uses a template that includes a razor file that gets called... The Razor file you include in your paragraph template is made for a layout template, so they do not match...

So, instead of doing all these kind of magic, simply create your minicart directly in the layout template using html tags.

Attached the markup you need

Votes for this answer: 1
 
Martin Kure
Reply

Hi Nicolai, 

I kinda knew, I had to do it that way :-).

Thank you for your patience.

BR

Martin

 

You must be logged in to post in the forum