Add chart link next to a variant selectbox

  • Posts: 56
  • Thank you received: 2
9 years 8 months ago #226477

-- HikaShop version -- : 2.6.0 Business
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.5.12
-- Browser(s) name and version -- : FF 40.0.2
-- Error-message(debug-mod must be tuned on) -- : N.A

HI Hiakshop crew !!

Ok,so I have many different variants.ie:Colors, sizes,patterns, etc...

What I attempting to do is add a link right after the variant selectbox. And that link is in the module and when clicked opens custom modal. So , in other words the link and modal is all contained in the module I'm trying to load conditionally.

So I need to editing/customize the products/show_block_characteristics
All I want to do is get the variants field label value (ie.: Colors.Sizes,etc) and using a switch statement load the corresponding module after the selectbox .
I included a screenshot, as it will will be obvious to see what I'm trying to do.

I was thinking of just adding a switch statement to load the corresponding module.
Example only - so variables might not be correct.

switch ($variants_name) {
	case 'Colors':
		echo JHTML::_('content.prepare','{loadposition colorchart}');
		break;
	case 'Sizes':
		echo JHTML::_('content.prepare','{loadposition sizechart}');
		break;
	default:
		break;
The only catch is I'm not exactly sure where I should add this code?
N.b: The module I load is the link to the chart and the custom modal (all in one).

Mind you,I did get it to work when I placed similar code into the show_block_custom_main.php, but that isn't where I want to place it.

Any ideas?

Attachments:

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 8 months ago #226543

Hi,

The view "show_block_characteristics" is the right view but you're using the dropdown display so it uses the type "characteristic" for the display and more specially his "displayFE" function.
administrator/components/com_hikashop/types/characteristic.php

So, I think that the best for you would be to copy the content of the function and place it into the view.
Thanks to that, you will be able to modify the return content using a view override (and not by modifying a core file).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 56
  • Thank you received: 2
9 years 8 months ago #226559

Thanks Jerome !!

Got it, did it , done !!
The buttons I'm using might get edited, but it works !
(c.f: attachment)

Thanks again for the quick support !
You guys/gals rock !

Merci beaucoup !
A+

V.

Attachments:

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

  • Posts: 56
  • Thank you received: 2
9 years 8 months ago #226589

HUm, maybe i spoke too soon.

It worked when I edited the core file,
but now that I copied over that function "display FE" into the view, it's not working.
I wonder what I'm missing something?? Hum?
I tried extending the class but that didn't work.

Once I've added the function to the show_block_characteristics.php is there anything else to do, besides my custom code?
I'm not exactly sure to how to override that function? Thought it would be obvious, but now I realize it not.
Help?

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 8 months ago #226591

Hi,

Yes, that's right ; the function displayFE use another function in the type and also use "$this".
So, you can create an override for the type, like explained in that thread :
www.hikashop.com/forum/product-category-...atermark.html#184987

But for the "types" folder instead of the "helpers" one and for the class "hikashopCharacteristicType" instead of "hikashopImageHelper".

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 56
  • Thank you received: 2
9 years 7 months ago #226848

Thanks a lot Jerome !!!
Got it working.

I don't think I would have ever guessed to use

include_once $originalFile;
variable, as I wasn't aware of its existence!! ;O )
but live and learn !

My mistake was to follow the Joomla docs example and create a 'code' folder for the override - in the template's directory.

Merci infiniment !
A+

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 7 months ago #226870

Hi,

Well, the line

include_once $originalFile
is not in the Joomla standards but it is something I added in the HikaShop override system in order to simplify the creation of overrides.
Thanks to it, you can decide to include (or not) the original file. In some case you might want to not include it and redefine everything.
You can see the definition of that variable in the HikaShop core helper file ; into the function "hikashop_get".

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 56
  • Thank you received: 2
9 years 6 months ago #231178

In the end I found a simpler way using "NoNumbers - Advanced modules manager Pro", you can set your rules in there; quite easily actually, without having to know any code (for those who can't ).

Peace.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum