Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

ship by mail icon.. (like the special offer icon) (i can pay for it)

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-01-2009, 07:01 PM
 
Christofer Christofer is offline
 

eXpert
  
Join Date: Apr 2009
Location: Thessaloniki, Greece
Posts: 202
 

Default if extra field eq "Y" show an image .. please help

Hello there, i need a custom mod, basically i don't know if it needs too much work. If it doesn't, and someone can guide me it would be great. If it needs too much work and someone can do it, i can pay for it.

Basically i need two things. i want to add an option on the page that you create the products. That option should ask "Ship by mail" and it will have the option yes and no.

The only function that i want to have, is : if i select yes, i want automatically to add a small icon down of the product picture (that icon will say "ship by email").. like the way the "special offer" icon appears, but not up to the picture, i want the icon to appear down of the picture..

for sure i want that icon to appear on product description page, but if it is possible to appear also while browsing the category, it would be nice..
__________________
X-Cart Gold : 4.2.1 (on linux parallels plesk / mysql)
Php v5.2.9 (Zend: 2.2.0) - MySql v5.0.79 - LiteSpeed server
Modules : X-Offer & X-Aom & One page checkout
Product tabs & Product downloads & many more
Reply With Quote
  #2  
Old 05-01-2009, 08:04 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: ship by mail icon.. (like the special offer icon) (i can pay for it)

You should be able to use extra fields to do this.

You can read about setting extra fields in the manual. You can create an extra field to use to store the "Set by Mail" variable for each product.

(You will have to do a bit of a mod to get it to do a radial or pull down to set the "Y" or "N" - or you can just enter the "Y" into the default text-box that xcart sets up for you.)

There are several posts on the forum describing how to retrieve the extra fields into your templates. You could start with this thread - it helps explain how to get the variable and do if/than based on the setting.

You can read the value of the extra fleld you make on the category page and the product page. You can do an if/than to display the icon when it is set to "Y"
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #3  
Old 05-02-2009, 05:09 AM
 
Christofer Christofer is offline
 

eXpert
  
Join Date: Apr 2009
Location: Thessaloniki, Greece
Posts: 202
 

Default Re: ship by mail icon.. (like the special offer icon) (i can pay for it)

ok i'll start reading. thank you for pointing me on the right place
__________________
X-Cart Gold : 4.2.1 (on linux parallels plesk / mysql)
Php v5.2.9 (Zend: 2.2.0) - MySql v5.0.79 - LiteSpeed server
Modules : X-Offer & X-Aom & One page checkout
Product tabs & Product downloads & many more
Reply With Quote
  #4  
Old 05-02-2009, 05:29 AM
 
Christofer Christofer is offline
 

eXpert
  
Join Date: Apr 2009
Location: Thessaloniki, Greece
Posts: 202
 

Default Re: ship by mail icon.. (like the special offer icon) (i can pay for it)

and what code should i use to show the image on the product.tpl? This i have bellow? I am not familiar..

my extra field service name is "ship_by_mail"

{if $extra_fields[field].ship_by_mail eq "Y"}
<img src="/skin1/images/myimage.gif" />{/if}

or

{if $extra_field.service_name eq "ship_by_mail"}
{if $extra_field.value eq "Y"}
<img src="skin1/images/custom/ship_by_mail.gif" />{/if}{/if}

none of those workings
__________________
X-Cart Gold : 4.2.1 (on linux parallels plesk / mysql)
Php v5.2.9 (Zend: 2.2.0) - MySql v5.0.79 - LiteSpeed server
Modules : X-Offer & X-Aom & One page checkout
Product tabs & Product downloads & many more
Reply With Quote
  #5  
Old 05-02-2009, 10:01 AM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: ship by mail icon.. (like the special offer icon) (i can pay for it)

Hi Christopher -

Look at posts #6 & #7 in this thread. Since you can have more than one extra field - they are stored in an array that you have to loop trough to get yours. In the examples - replace "Ingredients" with the name of your field "ship_by_mail".

Quote:
For example, this code in the top of product.tpl makes a bunch of variables, that can be used on product.tpl, and any other templates nested in it:
Code:
{section name=field loop=$extra_fields} {if $extra_fields[field].field eq "ship_by_mail" && $extra_fields[field].field_value ne ""} {assign var="ship_by_mail" value=$extra_fields[field].field_value} {/if} {/section}
You can temporarily print the variable in the template to make sure it is working.
Code:
<b>Ship By Mail:</b> {$ship_by_mail}<br />
If it looks okay - do an if/than based on the variable:
Code:
{if $ship_by_mail "Y"} <img src="{$ImagesDir}/myimage.gif" /> {/if}
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #6  
Old 05-02-2009, 10:22 AM
 
Christofer Christofer is offline
 

eXpert
  
Join Date: Apr 2009
Location: Thessaloniki, Greece
Posts: 202
 

Default Re: ship by mail icon.. (like the special offer icon) (i can pay for it)

this code have to be also in the product.tpl?

{section name=field loop=$extra_fields}
{if $extra_fields[field].field eq "ship_by_mail" && $extra_fields[field].field_value ne ""}
{assign var="ship_by_mail" value=$extra_fields[field].field_value}
{/if}
{/section}

i tried it but i think don't work. the image doesn't appear. I tried also the <b>Ship By Mail:</b> {$ship_by_mail}<br />
but it appears only the text with bold
__________________
X-Cart Gold : 4.2.1 (on linux parallels plesk / mysql)
Php v5.2.9 (Zend: 2.2.0) - MySql v5.0.79 - LiteSpeed server
Modules : X-Offer & X-Aom & One page checkout
Product tabs & Product downloads & many more
Reply With Quote
  #7  
Old 05-02-2009, 01:07 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: ship by mail icon.. (like the special offer icon) (i can pay for it)

yes - the loop must also be in the product.tpl - to debug, you can add something that writes out the variables inside the loop to make sure it is working and that the variables are as you expect.

{section name=field loop=$extra_fields}
<b>field</b>: {$extra_fields[field].field}<br />
<b>value</b>: {$extra_fields[field].field_value}<br />
{if $extra_fields[field].field eq "ship_by_mail" && $extra_fields[field].field_value ne ""}
{assign var="ship_by_mail" value=$extra_fields[field].field_value}
<b>Ship By Mail:</b> {$ship_by_mail}<br />
{/if}
{/section}
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #8  
Old 05-02-2009, 01:14 PM
 
Christofer Christofer is offline
 

eXpert
  
Join Date: Apr 2009
Location: Thessaloniki, Greece
Posts: 202
 

Default Re: ship by mail icon.. (like the special offer icon) (i can pay for it)

Quote:
Originally Posted by gb2world
yes - the loop must also be in the product.tpl - to debug, you can add something that writes out the variables inside the loop to make sure it is working and that the variables are as you expect.

{section name=field loop=$extra_fields}
<b>field</b>: {$extra_fields[field].field}<br />
<b>value</b>: {$extra_fields[field].field_value}<br />
{if $extra_fields[field].field eq "ship_by_mail" && $extra_fields[field].field_value ne ""}
{assign var="ship_by_mail" value=$extra_fields[field].field_value}
<b>Ship By Mail:</b> {$ship_by_mail}<br />
{/if}
{/section}

from that code it appears that :
field: Ship by mail
value: Y

but not the <b>Ship By Mail:</b> {$ship_by_mail}<br />
__________________
X-Cart Gold : 4.2.1 (on linux parallels plesk / mysql)
Php v5.2.9 (Zend: 2.2.0) - MySql v5.0.79 - LiteSpeed server
Modules : X-Offer & X-Aom & One page checkout
Product tabs & Product downloads & many more
Reply With Quote
  #9  
Old 05-02-2009, 01:44 PM
 
Christofer Christofer is offline
 

eXpert
  
Join Date: Apr 2009
Location: Thessaloniki, Greece
Posts: 202
 

Default Re: ship by mail icon.. (like the special offer icon) (i can pay for it)

well the one that worked is that :
Code:
{section name=field loop=$extra_fields} {if $extra_fields[field].field_value eq "Y" && $extra_fields[field].field eq "Ship by mail"} <img src="{$ImagesDir}/custom/ship_by_mail.gif" /> {/if}{/section}

so it looks like on the "$extra_fields[field].field" it wants the field name and not service name

thank you very much
__________________
X-Cart Gold : 4.2.1 (on linux parallels plesk / mysql)
Php v5.2.9 (Zend: 2.2.0) - MySql v5.0.79 - LiteSpeed server
Modules : X-Offer & X-Aom & One page checkout
Product tabs & Product downloads & many more
Reply With Quote
  #10  
Old 05-02-2009, 08:38 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: ship by mail icon.. (like the special offer icon) (i can pay for it)

Yes - the code I gave you will work if you replace "ship_by_mail" in the smarty comparisons with "Ship by mail"
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:59 PM.

   

 
X-Cart forums © 2001-2020