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

Use custom image for specific buttons?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-08-2011, 05:45 AM
 
kooki kooki is offline
 

Member
  
Join Date: Jun 2008
Posts: 20
 

Default Use custom image for specific buttons?

I'm trying to change the 'ask a question about this product' link into an image. How can I do this?

The default code is:

Code:
{include file="customer/buttons/button.tpl" button_title=$lng.lbl_ask_question_about_product style="link" href="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=`$product.productid`')"}

If I change the style to 'image', I get a small arrow button but not sure how to change that to my own image.
__________________
X-Cart 4.4.2
Reply With Quote
  #2  
Old 09-08-2011, 06:48 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Use custom image for specific buttons?

I am not going to test this one, but it looks like any image with a link that references:
"javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=`$product.productid`')"
is going to work.
So a standard setup for a linked image should be fine.
ie:
<a name="mypopuplink" id="mypopuplink" href="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=`$product.productid`')"><i mg src="{ImagesDir}/mypopupimage.jpg" /></a>

Then upload your image to skins/common_files/images or skins/images on older x-carts.

The name and id attributes I defined may not be necessary, but it is a good practice to always assign something.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #3  
Old 09-09-2011, 01:26 AM
 
kooki kooki is offline
 

Member
  
Join Date: Jun 2008
Posts: 20
 

Default Re: Use custom image for specific buttons?

I had already tried that, but the javascript didn't work.
__________________
X-Cart 4.4.2
Reply With Quote
  #4  
Old 09-09-2011, 04:53 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Use custom image for specific buttons?

Sorry it was late, and I was tired....

<a name="mypopuplink" id="mypopuplink" href="javascript:void(0);" onclick="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=2'); return false;"><img src="{ImagesDir}/mypopupimage.jpg" /></a>

Still haven't tested it, but it should work fine.

Edit: I have since tested this and it does work in at least IE9.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #5  
Old 03-01-2012, 01:58 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: Use custom image for specific buttons?

Hi Mike,
After adding these codes the popup is not open.How to resolve this issue?

Thanks.
__________________
4.6.1 Platinum


Reply With Quote
  #6  
Old 03-02-2012, 07:53 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Use custom image for specific buttons?

Hi Learner! I just tested this in my test site, and it works perfectly.

<a name="mypopuplink" id="mypopuplink" href="javascript:void(0);" onclick="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=2'); return false;"><img src="{ImagesDir}/mypopupimage.jpg" /></a>

I used the code you provided back to me so I can't imagine why this isn't working for you. Of course this link references "productid=2" and it is only going to work on the product page with that product id.

Try: productid=`$product.productid`

Hope that helps. Feel free to send me a coffee.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #7  
Old 03-03-2012, 01:57 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: Use custom image for specific buttons?

Hi Mike,

Thanks for your help.After adding this code the pop up opens for sometime and after that it vanishes...Is it any java script error ??

How to resolve this issue?

Kindly help me...
__________________
4.6.1 Platinum


Reply With Quote
  #8  
Old 03-03-2012, 06:21 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Use custom image for specific buttons?

Hi Learner, in response to your Pm:

You can see the code working on my test site: http://trainingpen.com/product.php?productid=17513&cat=0&page=&featured=Y

Click the Xcart logo in the description.

Here is the complete code from the template:
<a name="mypopuplink" id="mypopuplink" href="javascript:void(0);" onclick="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=17513'); return false;">
<img src="{ImagesDir}/admin_xlogo.gif" />
</a>

Okay I think I see why this isn't working for you. It all has to do with the right productid not being assigned. See how I included the productid hard coded? Try:
<a name="mypopuplink" id="mypopuplink" href="javascript:void(0);" onclick="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid={$product.productid}'); return false;">
<img src="{$ImagesDir}/admin_xlogo.gif" />
</a>

That should do it. Sorry this was so difficult.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #9  
Old 03-04-2012, 09:00 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: Use custom image for specific buttons?

Hi Mike,
Have you seen this in my site??click http://www.health-shoppe.com/TURMERIC-SKIN-and-ALLERGY-CARE/ and see Ask a question image and you will see that pop open and certain time it vanishes.

I have added
<a name="mypopuplink" id="mypopuplink" href="javascript:void(0);" onclick="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid={$product.productid}'); return false;">
<img src="{$ImagesDir}/myimage.jpg" />
</a>
this code but not solved.

How to resolve my issue?

Thanks.
__________________
4.6.1 Platinum


Reply With Quote
  #10  
Old 03-04-2012, 02:56 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Use custom image for specific buttons?

Learner, look again at the code I posted. You appear to be missing the productid like I said. When I look at the source of the page, I see:

<a name="mypopuplink" id="mypopuplink" href="javascript:void(0);" onclick="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=`$product.productid`'); return false;"><img src="skin/artistictunes_business/images/custom/ask02.jpg"></a>

Change this to:
<a name="mypopuplink" id="mypopuplink" href="javascript:void(0);" onclick="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid={$product.productid}'); return false;"><img src="skin/artistictunes_business/images/custom/ask02.jpg"></a>

Remove the`` and add the{} around $product.productid

What is happening, is the popup cannot figure out which product this is about. If you removed $product.productid and put the right productid for that product directly it will work as well.

Like my original code:
<a name="mypopuplink" id="mypopuplink" href="javascript:void(0);" onclick="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=2'); return false;"><img src="{ImagesDir}/mypopupimage.jpg" /></a>

This will work only if the productid is 2. If you change that number to your productid, it should work. I am simply telling you this so you will understand, obviously you want this to work on every product page, and you need to use the {$product.productid} to make that happen. But try it with the actual number put in if you need to test.

Your site looks nice BTW.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
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 02:58 AM.

   

 
X-Cart forums © 2001-2020