Different Category View

  • Posts: 120
  • Thank you received: 1
12 years 6 days ago #75486

Hello,

First of all, my shop is up and running, bringing much more revenue than the previous one! Thanks for the nice component!

I am now polishing some views and I do need to have different layouts for "brands listing" and "product listing".

What I need is to have <products list> ABOVE and <category description> BELOW for my shop. However, I need to have vice versa: <products list> BELOW and <category description> ABOVE for brands.

I can see the view named CATEGORY / LISTING.PHP. In that view I can change the secuence of <products list> and <category description> with my minimum knowledge of PHP. However, if I change it, the change is applied to ALL my categories.
Is there a possibility to have a reverse view for some categories?

Thanks.

/I am running Hikashop Business 2.0.0/

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

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 4 days ago #75772

Hi,


There is no option for it, but in the code, you can use conditions on $this->element->category_type in order to change the order when it is "product" or "manufacturer". So like that:

if($this->element->category_type=="manufacturer"){
//code for brands
}else{
//code for categories
}

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

  • Posts: 120
  • Thank you received: 1
12 years 3 days ago #76021

Nicolas, thanks for your nice and quick support (as always). I will try that solution.

I believe the best solution is to have two category descriptions at the backend: DESCRIPTION-1 on the top and DESCRIPTION-2 on the bottom. Such solution will allow to easily put text either on top or on bottom or both.

I think I will be unable to code that without hacking main code, because I will need to introduce a new table in database? (And I do not want to hack core component of Hikashop.)

Have a good week!

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

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
12 years 3 days ago #76025

Hi,

I don't think that core modification are required.
Using custom field and view override you could have a working solution.

By creating a custom field, you would create a new column in the table.
By overriding the view, you could change the way that a specific custom field would be displayed.. So you can display a complete editor (or keep a text-area if it's too complicated).
After that, you would be able to access to the custom field like you access to the product_description.

And you might find a solution which would be more like you want but I am sure that, using custom fields and view override, you can do want you want without modifying the HikaShop core.
(And you can create plugin-custom-field if you want a ultra specific solution).

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.
The following user(s) said Thank You: watashi

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

  • Posts: 120
  • Thank you received: 1
11 years 11 months ago #77209

Hi Jerome,

That really works!!

Now, when I edit a category, I have an extra text field on the right.
However, that text field is not using my default editor (CodeMirror), but a simple textbox.
In other words, if I press ENTER key in that field, it will actually insert <BR /> teg.

Is there any way I can ibnstruct it to use my default editor?

I understand the following piece fo code is responsible:

                    <?php $onWhat='onchange'; if($oneExtraField->field_type=='radio') $onWhat='onclick'; ?>
                    <?php echo $this->fieldsClass->display($oneExtraField,$this->element->$fieldName,'data[category]['.$fieldName.']',false,' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'category\',0);"'); ?>

I tried to modify it a little bit, but seems my "knowledge" of PHP is not enough to do even this simple modification?
                    <?php 
                       $this->editor->content = @$this->element->descbottom;
                       echo $this->editor->display();
                    ?>

/descbottom is the name of my custom field/

Now it displays some extra editor's buttons (Product, Article, Image, Readmore etc), and also another text area under the main description:



What do I do wrong? It is not that simple? :)

Attachments:

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

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
11 years 11 months ago #77219

Hi,

HikaShop instantiate an editor object in the variable $this->editor but this object have several options.
You have to define "$this->editor->name" to change the name of the input name.
Because otherwise, it would use the same name than the main description and the javascript for initialize codemirror would not work (same name twice, would just work on the first).

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: 120
  • Thank you received: 1
11 years 11 months ago #77262

Hi Jerome,

Thanks for your quick respond. I have tried to modify the code as per your advice, but the behaviour of my system has not changed at all.

My current code is like this:

                    <?php
                       $this->editor->name = 'descbottom';
                       $this->editor->content = @$this->element->descbottom;
                       echo "--".$this->editor->name."--";                    
                       echo $this->editor->display();
                    ?>

Is there some very simple mistake? Can you kindly point it out?
I that is not that easy, do you think Commercial Jobs section can help me with this very small issue..

THANK YOU!

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

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
11 years 11 months ago #77582

Hi,

The name should be "data[category][descbottom]" if you want that HikaShop retrieve the information in the good place.

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: 120
  • Thank you received: 1
11 years 11 months ago #77584

It does not work for ma as well due to lack of my software engineering knowledge (actually zero level). :)

However, I have created a workaround using "if" condition, as recommended by Jerome. That basically fits my needs. Not a perfect solution, but that is enough for the time being.

Thanks for your support!

regards

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

Time to create page: 0.078 seconds
Powered by Kunena Forum