We understand that your ecommerce site is crucial to the success of your business, from time to time issues and questions can arise and you need to have the assurance there will be someone on hand to help resolve these in a timely fashion so you can spend your time driving your own business forward.

So if you are looking for faster responses to your questions or would like the assurance there is someone on hand for you to contact, fear not we have a number of paid support options that are available to you that can give your organisation the peace of mind knowing a member from the Cart Viper team will always be available to assist!

Purchase a Support Plan

Community Support

HomeHomeIssues and Supp...Issues and Supp...Templates & UITemplates & UIVariant Display problemsVariant Display problems
Previous
 
Next
New Post
12/23/2017 6:37 AM
 
I have created some products that use multiple variants.  I'm having two issues with displaying those variants.  While the product display shows them in the order I have defined them (and set in their sort order), the cart data and order confirmations show the variants in a completely different order.  Is there any way to control the display order of the variants?

My second issue is the display of the variants in the cart and order confirmations.  All variants are run together as a single "paragraph" type format.  I have solved this on the order confirmation by using a database trigger to rewrite the variant XML data that adds <br/> tags into the XML to put the variants on separate lines.  That would be really helpful if it could be done on the records for items in the cart.  Unfortunately, it appears that the cart records are not stored in the same format so I'm unable to use a db trigger to reformat them on the fly.

Is there any other way to get hooks into this data that I can change it as needed?
 
New Post
12/30/2017 7:09 PM
 
Hi,

I tried this on my test site and it worked ok, can you provide a screen shot of your variants showing the sort orders etc?

Our templates support Razor scripts so you can access any of the underlying data and output as per your needs, if you copy the below script and save it to a file named "CartItemProductVariants.cshtml" and add it into your "scripts" folder. That way you modify the "CartDetailsItem.htm" template, remove the standard token [VARIANTDETAILS] and replace with [RAZOR:CartItemProductVariants.cshtml,ITEMID]

Currently the script will just output the variants in the same format as our token but you can modify as per your needs.



@using System.Dynamic;
@using System.Text;
@using CartViper.Modules.Store.Cart;
@using CartViper.Modules.Store.Extensions;

@inherits DotNetNuke.Web.Razor.DotNetNukeWebPage<dynamic>

@{

    // load it onto CartDetailsItem.htm with the below:
    //[RAZOR:CartItemProductVariants.cshtml,ITEMID]
    var lineItem = new CartController().GetItem(int.Parse(Model.ITEMID));
    StringBuilder buffer = new StringBuilder();

    if (lineItem.HasVariantOptions())
    {
        try
        {
            foreach (var item in lineItem.Variants())
            {
                if (item == null || item.ProductVariant() == null)
                {
                    continue;
                }

                if (item.ProductVariant().ControlType == "Textbox" || item.ProductVariant().ControlType == "TextboxMultiLine")
                {
                    buffer.AppendFormat("<strong>{0}</strong> - \"{1}\", ", item.VariantName, item.OptionValue);
                }
                else if (item.ProductVariant().ControlType.Equals("ImageUploader"))
                {
                    buffer.AppendFormat("<strong>{0}</strong> - <a rel='hypProductVisualizer' href=\"{2}\">{1}</a>, ", item.VariantName,
                                                                                                                        "User supplied image",
                                                                                                                        item.OptionValue);
                }
                else if (item.ProductVariant().ControlType.Equals("FileUploader"))
                {
                    buffer.AppendFormat("<strong>{0}</strong> - <a target=\"_blank\" href=\"{2}\">{1}</a>, ",
                                            item.VariantName,
                                            "User supplied file",
                                            item.OptionValue);
                }
                else
                {
                    buffer.AppendFormat("<strong>{0}</strong> - {1}, ", item.VariantName, item.OptionName);
                }
            }

            //trim
            if (buffer.Length > 2)
            {
                buffer.Remove(buffer.Length - 2, 2);
            }
        }
        catch (Exception)
        {

        }
    }

    @buffer.ToString()
}









 
New Post
12/30/2017 10:20 PM
 
Thank you!  This script works perfectly.  I modified each variant type where it begins with <strong> to instead output <br/><strong> so that it starts a new line for each variant.

Not 100% sure, but for the sort order, it appears it is using CVStore_CartItemsAttributes.attributeId as the display order when output in the basket.  As a quick hack, I modified [CVStore_CartItemsAttributes_GetAttributes] to add "Order By value".  Since my VariantId's are defined in the order I need, this works.  (I know, not a great approach, but works for now).
 
New Post
12/30/2017 10:25 PM
 
An additional issue I have with the variants is gaining access to the stored values in the [CVStore_OrderDetailsAttributes].value field to use for reporting purposes.  I need to create some SQL queries that pulls order data and summarizes based on the variant values.  Since the variant values are only stored in embedded XML, I'm finding it difficult to query and use the data.

What's the easiest way to query these values?
 
New Post
12/31/2017 11:40 AM
 
Writing SQL queries against the variants is possible but tricky as we store the variants as a serialized XML list. I would recommend writing a module so you could reference our CartViper.Modules.Store.dll assembly in your custom module.

That way you can use our methods in the OrderController.cs to load orders and it would return the OrderInfo and OrderDetailsInfo objects fully populated with data that you could then process / aggregate as per your needs.

If however you want to use SQL and query the tables directly, the below has some useful info on SQL queries with XML data in the columns:

https://stackoverflow.com/questions/10344553/how-can-i-query-a-value-in-sql-server-xml-column

Regards
 
Previous
 
Next
HomeHomeIssues and Supp...Issues and Supp...Templates & UITemplates & UIVariant Display problemsVariant Display problems


 

We use cookies on our website to improve our service to you, by continuing you agree to our use of cookies. However you are able to update your settings at any time.

Cookie Policy

A cookie, also known as an HTTP cookie, web cookie, or browser cookie, is a piece of data stored by a website within a browser, and then subsequently sent back to the same website by the browser. Cookies were designed to be a reliable mechanism for websites to remember things that a browser had done there in the past, which can include having clicked particular buttons, logging in, or having read pages on that site months or years ago.

Strictly Necessary Cookies

These cookies cannot be disabled

These cookies are necessary for the website to function and cannot be switched off. They are normally set in response to your interactions on the website e.g. logging in etc.

Cookies:
  • .ASPXANONYMOUS
  • .DOTNETNUKE
  • __RequestVerificationToken
  • authentication
  • CV_Portal
  • CV_Store_Portal_Cart_0
  • CV_USER
  • dnn_IsMobile
  • language
  • LastPageId
  • NADevGDPRCookieConsent_portal_0
  • userBrowsingCookie

Performance Cookies

These cookies allow us to monitor traffic to our website so we can improve the performance and content of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited or how you navigated around our website.

Cookies:
  • _ga
  • _gat
  • _gid

Functional Cookies

These cookies enable the website to provide enhanced functionality and content. They may be set by the website or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.

Cookies:

Currently we are not utilizing these types of cookies on our site.

Targeting Cookies

These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.

Cookies:

Currently we are not utilizing these types of cookies on our site.

Feedback