Making a link inside a box area

  • Posts: 74
  • Thank you received: 1
12 years 4 months ago #57369

Hi,

I am using the Hagane template.

One of my menu pages displays three product categories.

The proceed further the user has to click on a specific text/link (e.g. 594mm x 420mm).
But I would like the user to be able to click anywhere inside one of the rounded boxes (3), but I need help in achieving this?

Thanks.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82819
  • Thank you received: 13366
  • MODERATOR
12 years 4 months ago #57417

Hi,

You need to edit the file "listing_div" of the view "category" via the menu Display>Views and change the line:

<div class="hikashop_subcontainer <?php echo $borderClass; ?>">

to:
<div class="hikashop_subcontainer <?php echo $borderClass; ?>" onclick="document.location.href='<?php echo hikashop_completeLink('category&task=listing&cid='.$row->category_id.'&name='.$row->alias.$this->menu_id); ?>';">

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 1
12 years 4 months ago #57498

Hi Nicolas,

Many thanks for the suggestion, however if I have done it correctly I can now link on the text (e.g. 594mm x 420mm) and the image itself.
What I would like to do is to be able to link anywhere within the larger grey rounded corner border box.


if($only_if_products && $row->number_of_products<1) continue;
?>
<div class="hikashop_category hikashop_category_column_<?php echo $current_column; ?> hikashop_category_row_<?php echo $current_row; ?>" style="width:<?php echo $width;?>%;">
<div class="hikashop_container">
<div class="hikashop_subcontainer <?php echo $borderClass; ?>" onclick="document.location.href='<?php echo hikashop_completeLink('category&task=listing&cid='.$row->category_id.'&name='.$row->alias.$this->menu_id); ?>';">
<?php
$this->row =& $row;

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 1
12 years 4 months ago #57504

Actually it is working.

I did not realise, as the 'hand' mouse pointer only shows over the images and the text, otherwise it's the normal pointer.
It would be nice to have a 'hand' pointer show over the whole larger grey rounded corner border box, but I can live without it.

Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 82819
  • Thank you received: 13366
  • MODERATOR
12 years 4 months ago #57571

You can do that by adding such CSS:
.hikashop_subcategories .hikashop_subcontainer{
cursor:pointer;
}

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 1
12 years 4 months ago #57700

Hi Nicolas,

Many thanks for this.
I appreciate it may not have been a totally HikaShop question, but answered brilliantly just the same.

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 1
12 years 4 months ago #57941

Hi Nicolas,

I wanted to do the same in my next level down, where the user selects one of four products by clicking anywhere inside each product box, by copying your code above

change:
<div class="hikashop_subcontainer <?php echo $borderClass; ?>">

to:
<div class="hikashop_subcontainer <?php echo $borderClass; ?>" onclick="document.location.href='<?php echo hikashop_completeLink('category&task=listing&cid='.$row->category_id.'&name='.$row->alias.$this->menu_id); ?>';">


in Display > Views > Product > Listing_Div, but this time I get an error 404.
Can you advice me please what I need to change to make it work.

Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 82819
  • Thank you received: 13366
  • MODERATOR
12 years 4 months ago #58000

That's the only code to change. There is no other solution.

Can you give a link to that page so that we can see the result ?

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 1
12 years 3 months ago #58077

Hi Nicolas,

Unfortunately as the website is still being built/tested it's local using WampServer at the moment.
I would be happy to install a remote login if you wished, for you to log into my PC.

If this helps, I have found the following:



If you click on the actual link 'A3SG' it works correctly, directing you to page (note the URL):



If you click anywhere else inside the box it doesn't work, directing you to page (note the URL):



Many thanks.

Attachments:
Last edit: 12 years 3 months ago by Southcoaster.

Please Log in or Create an account to join the conversation.

  • Posts: 82819
  • Thank you received: 13366
  • MODERATOR
12 years 3 months ago #58132

Oh I missed some information in your previous post. The screenshots helped to clearly understand.

You should actually use that code instead:

<div class="hikashop_subcontainer <?php echo $borderClass; ?>" onclick="document.location.href='<?php echo hikashop_completeLink('product&task=show&cid='.$row->product_id.'&name='.$row->alias.$this->menu_id); ?>';">

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 1
12 years 3 months ago #58290

Hi Nicolas,

Many thanks, worked a treat (of course).

Please Log in or Create an account to join the conversation.

Time to create page: 0.092 seconds
Powered by Kunena Forum