Jump to content

Possible BUG: Changes in viewcart.tpl is not being displayed


Mechanic

Recommended Posts

Hi,

I have created a duplicate template of the [standard cart] and edited the [configureproduct.tpl] and [viewcart.tpl] to display a few lines of text. While testing to check the texts display properly, I noticed the text in [product.tpl] shows up properly but the text in [viewcart.tpl] does not display at all.

The new templates name is [myonecart]. It has all the files the [standard cart] has. Only the [configureproduct.tpl] and [viewcart.tpl] files were modified. All other files were untouched.

The [standard cart] is set as the default template in [Setup > General Settings > Ordering].

The [myonecart] is set as the default template in [Setup > Products/Services > Edit Group]

However, if I set [myonecart] as the default template in [Setup > General Settings > Ordering], the text in [viewcart.tpl] displays without any issue - when 1) [myonecart] is set as default in [Setup > Products/Services > Edit Group] 2) [Use System Default] is set as default in [Setup > Products/Services > Edit Group]

Without putting lines of texts, I have tried using a single word but the results are the same.

Is this the expected behavior or is it a bug?

I am using WHMCS 7.8.3 with a development license to test things out. Would appreciate if anyone could confirm if this is a bug in WHMCS.

 

Link to comment
Share on other sites

13 hours ago, Mechanic said:

The [myonecart] is set as the default template in [Setup > Products/Services > Edit Group] 

WHMCS will use the default template set in ' Setup > General Settings > Ordering ' for the viewcart.tpl.  That is intended behaviour.

If you have multiple products in your cart, and all these product groups have different cart templates, which template should it use? 😅 It'll always use the global default - and it's the same for checkout.tpl.

Link to comment
Share on other sites

14 minutes ago, DennisMidjord said:

f you have multiple products in your cart, and all these product groups have different cart templates, which template should it use? 😅 It'll always use the global default - and it's the same for checkout.tpl.

Nope, it should use the template defined in the Product Group. This is why this setting exists.

Edited by Mechanic
Link to comment
Share on other sites

No, not when you click 'View Cart' and go to viewcart.tpl.

Try to answer this:

16 minutes ago, DennisMidjord said:

If you have multiple products in your cart, and all these product groups have different cart templates, which template should it use? 😅 It'll always use the global default - and it's the same for checkout.tpl. 

How would WHMCS know which viewcart.tpl template to show? Should it show 10 different templates, if you have 10 different products in the cart that are all in their own product group, having their own template set?

Edited by DennisMidjord
Link to comment
Share on other sites

2 minutes ago, DennisMidjord said:

How would WHMCS know which viewcart.tpl template to show? Should it show 10 different templates, if you have 10 different products in the cart that are all in their own product group, having their own template set?

Go to WHMCS > Products / Services > Edit Group > Specify a Template

A specific product in a specific group should use the template specified in the group settings, regardless of how many products you have or not. This is why there is an option to set cart templates on per group basis. 

You are not confusing client area templates with cart templates, are you?

Link to comment
Share on other sites

1 minute ago, Mechanic said:

A specific product in a specific group should use the template specified in the group settings, regardless of how many products you have or not

But how are WHMCS deciding which template to show?

Let's say you have 3 product groups. Each product groups has 1 product. Each product group also has its own template specified from ' Products / Services > Edit Group > Specify a Template'.

Now you go and add the product that is in each product group and go and view your cart - all 3 product groups has its own template, so which template do you expect WHMCS to show? It'll use the globally default template. You can't have it show 3 different templates at a time. See this: https://docs.whmcs.com/Order_Form_Templates

Quote

Please Note: The view cart and checkout steps will always use the default order form template. This is because the cart can contain products from many different product groups at the same time.

It has been like that forever.

Link to comment
Share on other sites

14 hours ago, Mechanic said:

Is this the expected behavior or is it a bug?

fwiw, I would agree with Dennis on this in that it's always been like this... e.g I just set my 7.7 dev to use Modern as the default orderform, and assigned SC to the first group... it used SC all the way until viewcart, and then it switched to Modern.... obviously with these two templates, the difference is clear, but it wouldn't be as clear with two versions of SC.

I suspect for you the workaround would either be a conditional statement in the standard_cart/viewcart.tpl code, or a ClientAreaPageCart hook - depending on what this text is and where you want to put it.

Link to comment
Share on other sites

  • WHMCS Support Manager

Hi all,

I can confirm this has been the designed behaviour since v6.1 when we introduced the concept of providing a different product selection page per group.

To customise the cart and checkout experience, you'd add override files to the template selected in the Setup > General Settings > Ordering tab.

Link to comment
Share on other sites

 
 
 
1
On 9/24/2019 at 8:56 PM, DennisMidjord said:

But how are WHMCS deciding which template to show?

 

 
 
 
1
On 9/24/2019 at 9:59 PM, brian! said:

fwiw, I would agree with Dennis on this in that it's always been like this...

 

 
 
 
1
On 9/25/2019 at 4:27 AM, WHMCS John said:

I can confirm this has been the designed behaviour since v6.1 when we introduced the concept of providing a different product selection page per group.

 

This may have been current behavior but not logical.

WHMCS should fallback to the default template only if 1) There are multiple products from different product groups and different product groups have different templates and 2) There is a conflict between product characteristics and the template set in the product group.

Link to comment
Share on other sites

14 hours ago, Mechanic said:

This may have been current behavior but not logical.

there are lots of features of WHMCS that aren't logical - it's probably a fruitless task to wait for WHMCS to change them.

14 hours ago, Mechanic said:

WHMCS should fallback to the default template only if 1) There are multiple products from different product groups and different product groups have different templates and 2) There is a conflict between product characteristics and the template set in the product group.

I suppose if you really had/wanted to, you could move that logic into a hook and redirect to the "correct" viewcart based on the contents of the cart.... though whether that's worth it if the only differences between the templates area few lines of text, i'm unsure.

4 hours ago, DennisMidjord said:

Create a feature request.

👴

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated