Different layout type for categories

  • Posts: 154
  • Thank you received: 10
12 years 4 months ago #90161

Hi there!

I'm having a bit of a problem with something. I'm doing a webshop for a paint-store that wants color-choice per product. That's no problem at all cause the custom fields give me that option. The problem is this:

Just before the input field for the color-choice there needs to be a link to the website www.kleurenwaaier.net for color reference, I managed that just fine by adding the code in the sourcecode:

<a class="modal" href="http://www.kleurenwaaier.net" rel="{handler: 'iframe', size: {x: 800, y: 600}}">Kleurenwaaier.net</a>
in the show_default.php file. It works like a charm!
There's just one problem, now this website link also shows for brushes and other paint supplies, and I dont need that ^^

Is there a PHP code I can add to the show_default.php file to only show the link when the input box is there? something like if-exist 'kleurkeuze' then show <a href"> if-not then show "x"
I'm no PHP junkie so if someone could hook me up i'd really appreciate it!

Thanx!


Proud of my website www.hetcomputerwinkeltje.nl

Currently just running catalog mode, but hope to go live soon again :)

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

  • Posts: 13201
  • Thank you received: 2322
12 years 4 months ago #90182

Hi,

You can maybe try to display the link only if this if condition is ok:

foreach ($this->fields as $fieldName => $oneExtraField) {
    if($fieldName == 'yourFieldName'){
        // Display Link
    }
}

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

  • Posts: 154
  • Thank you received: 10
12 years 4 months ago #90187

Hi!

Thanx for the fast response,

The name of the box is 'kleurkeuze' So I copy and paste the following and it should all work?

foreach ($this->fields as $fieldName => $oneExtraField) {
    if($fieldName == 'kleurkeuze'){
        // Display Link
    }
}


Proud of my website www.hetcomputerwinkeltje.nl

Currently just running catalog mode, but hope to go live soon again :)

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

  • Posts: 83993
  • Thank you received: 13605
  • MODERATOR
12 years 4 months ago #90380

No, not just like that... You need to add your link in that code of course !

So it should look like that:

<?php
foreach ($this->fields as $fieldName => $oneExtraField) {
    if($fieldName == 'kleurkeuze'){ ?>
<a class="modal" href="http://www.kleurenwaaier.net" rel="{handler: 'iframe', size: {x: 800, y: 600}}">Kleurenwaaier.net</a>
<?php
    }
}
?>

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

  • Posts: 154
  • Thank you received: 10
12 years 4 months ago #90417

Hi!

I figured that much and I tried the exact code you just gave me but now it's not showing for any of the products :(


Proud of my website www.hetcomputerwinkeltje.nl

Currently just running catalog mode, but hope to go live soon again :)

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

  • Posts: 13201
  • Thank you received: 2322
12 years 4 months ago #90592

Hi,

I think that you have a restriction problem for this field. When you have configured it, have you restricted it on a category ?
You have to limit this custom field on a category, and add this category in the desired products only, and it should work.

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

  • Posts: 154
  • Thank you received: 10
12 years 3 months ago #91250

Hi there!

The field 'kleurkeuze' is limited to a category and it's subcategories if that's what you mean?

You can see it in action on www.verfgoedkoper.nl
When you go to www.verfgoedkoper.nl/index.php/verf-wijz...glanslak-ready-mixed
you see the ralkleuren.net link just above the 'kleurkeuze' field.

I don't really know what you mean by limit the custom field?


Proud of my website www.hetcomputerwinkeltje.nl

Currently just running catalog mode, but hope to go live soon again :)

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

  • Posts: 83993
  • Thank you received: 13605
  • MODERATOR
12 years 3 months ago #91474

Hi,

The assumption was that the custom field was of the table "product", but I can see that it's actually of the table "item" on your page.
So it should not be $this->fields but $this->itemFields in the code above and that should work better.

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

Time to create page: 0.076 seconds
Powered by Kunena Forum