Jump to content

Need help with URLs in dropdown menu


adg273

Recommended Posts

Hi,

First off let me explain that i'm not a developer, so i'm new to most of this, so please bear with me.

I have created hooks that change where the product categories point to on both the navigation bar and the categories sidebar.  However, on smaller screens, it resorts to using a drop down box and you switch product categories using this method (Image attached). As a result, these still point to where they would as default.

I need these to point to the new locations too. Can anyone advise me how I do this please?

Support added this when I queried how it worked;
 

Quote

 

In this case, you would likely want to modify the templates/orderforms/standard_cart/sidebar-categories-collapsed.tpl file.

As you can see, this is simply a quick action menu offering some various navigation options. You could use the smarty logic here to dynamically change the link if desired here!

 

 

I wasn't entirey sure how I go about achieving what I needed with this information, since I looked at sidebar-categories-collapsed.tpl and I can't see how this helps me.  When asked to clarify how I do this, they pointed me to here.

Any help would be greatly appreciated.

Screenshot 2019-06-19 at 17.16.43.png

Link to comment
Share on other sites

Actually, my apologies, Ive worked it out.

Surprisingly simple actually. Although possibly not the most ideal way to do it, but it works exactly as intended.

For anyone else looking for the same thing, what I did was manually change the options within sidebar-categories-collapsed.tpl

For example;

<optgroup label="Product Categories">
                   <option value="https://target-domain.com/cloud-hosting/">Cloud Hosting</option>
                   <option value="https://target-domain.com/web-hosting/wordpress-hosting/">WordPress Hosting</option>
</optgroup>

and changed the  <select> tag to include - onchange="location = this.value;"

<select name="gid" class="form-control" onchange="location = this.value;">

 

It works as intended for me, but any developers with a better way, it would be advantageous to post how.

Edited by adg273
Link to comment
Share on other sites

On 21/06/2019 at 20:04, adg273 said:

First off let me explain that i'm not a developer, so i'm new to most of this, so please bear with me.

I still, after 4 years, find it bizarre that someone at WHMCS thought it a really good idea to launch a menu system that effectively requires PHP coding in order to change it... oh well. 🙄

On 21/06/2019 at 20:04, adg273 said:

I wasn't entirely sure how I go about achieving what I needed with this information, since I looked at sidebar-categories-collapsed.tpl and I can't see how this helps me.  When asked to clarify how I do this, they pointed me to here.

aahh the old Support Dept line - "that's customisation - we don't deal with that... send them to the forums". 🙄

On 21/06/2019 at 20:47, adg273 said:

It works as intended for me, but any developers with a better way, it would be advantageous to post how.

not really better ways... I mean if the url is basically replacing spaces in the product group name with a hyphen, then you could still foreach through the array, but that won't save you much - especially if there will be exceptions to that rule...

I think you've pretty much solved it yourself - just remember to keep a copy of the file in case you lose it after a WHMCS update.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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