E-junkie - We help you sell online
World Class Solution - Damon @ PayPal
Sell & promote your products Join affiliate programs offered by sellers Shop Community
  Google Custom Search

E-junkie Ecommerce Forums » E-junkie Discussions

Tag Cloud for this topic:

Homepage thumbnails disappear



Dramatis
member
Posts: 4


Hi,

I am developing a site in WordPress based on the Mimbo theme, which uses software called TimThumb to automatically generate thumbnail images for posts for display on the home page etc. The problem is that when I add E-Junkie buttons to posts the thumbnail for any post containing E-Junkie buttons fail to display on the home page.

I have tried using the non-javascript buttons but it makes no difference. I have looked at the generated source code for the home page and it is clear that somehow when I add E-Junkie the button code screws up the paths to to the TimThumb images.

This is what a working image code looks like:

<img alt="" src="http://dramatisdei.com/wp-content/themes/dramatis/scripts/ timthumb.php?zc=1&w=60&h=60&src=/wp-content/uploads/2009/07/ MarmiteJesus2701.jpg" /></a>

and this is the broken image:

<img alt="" src="http://dramatisdei.com/wp-content/themes/dramatis/scripts/ timthumb.php?zc=1&w=60&h=60&src=/ej/ej_view_cart.gif" /></a>

The second src statement now has a path of "src=/ej/ej_view_cart.gif" substituted.

Anyone any Ideas how to get round this? Anyone experienced anything similar? I really really want to use E-Junkie!


#
POSTED ON: November 2, 2009 @ 07:08 GMT -7
MODIFIED ON: November 3, 2009 @ 06:05 GMT -7




Dramatis
member
Posts: 4


Oh, my website is at http://dramatisdei.com


#
POSTED ON: November 3, 2009 @ 06:55 GMT -7




E-junkieChef
E-Junkie Crew
Posts: 922


Can you check the documentaion of TimThumb to see if they let you add a paramter to to the img tag which makes it "skip" that particular image?


#
POSTED ON: November 3, 2009 @ 07:13 GMT -7




Dramatis
member
Posts: 4


Hmm, I'll look to see if there is relevant documentation but only thumbnails the first image in a post so I don't understand why it would be looking at the button images anyway.


#
POSTED ON: November 3, 2009 @ 13:49 GMT -7




Dramatis
member
Posts: 4


I couldn't find why this was happening but on reflection decided to do this a whole different way. I thought I would share my solution here for anyone else using WordPress.

Basically, I put the script element of the View Cart code in my header template (header.php), the rest of the View Cart code and the Add To Cart code in the post template (single.php), and then added a custom field to the post to pass the E-Junkie Item No to the button code.

It works and was far easier than I had thought it might be! I'll give the details now.


First, take the script code from the View Cart code - that's everything between the first "<script" and the final "script>" - should be about six lines. Insert it into your header template (header.php) in the <head> section - I put it just before the "<link rel=" lines.


Second, look at your Add To Cart code and find the item number - it is the number that comes straight after the "i=", mine was a six digit number. Make a note of that number. Now, go to edit your post where you want the buttons. Towards the bottom of the page you have a big block headed "Custom Fields". Create a custom field by adding a meaningful field name (I used "ej_itemno"), and add the item number you just noted in the value box. Publish the post. That itemno is now linked to the post.


Third, edit your single post template (single.php). just before or after the main content (displayed using the line starting "<?php the_content") paste your Add To Cart and View Cart button code (minus the script bit you've already put in the header). Now, where the itemno appears ("i=xxxxxx") replace that with i=<?php echo(get_post_meta($post->ID, 'ej_itemno', true)); ?> (if your custom field wasn't called ej_itemno then change that bit). This will pump your itemno from the post into the code.

You want to only show the buttons where the post has an E-Junkie itemno so surround the code you've just pasted with these lines:

<?php if ( get_post_meta($post->ID, 'ej_itemno', true) ) { ?>
<p>
</p>
<?php } ?>

Your finished code will look something like this:

<?php if ( get_post_meta($post->ID, 'ej_itemno', true) ) { ?>
<p>
<a href="https://www.e-junkie.com/ecom/gb.php?c=cart&i=<?php echo(get_post_meta($post->ID, 'ej_itemno', true)); ?>&cl=12345&ejc=2" target="ej_ejc" class="ec_ejc_thkbx" onClick="javascript:return EJEJC_lc(this);"><img src="http://www.e-junkie.com/ej/ej_add_to_cart.gif" border="0" alt="Add to Cart"/></a>
<a href="https://www.e-junkie.com/ecom/gb.php?c=cart&cl=12345&ejc=2" target="ej_ejc" class="ec_ejc_thkbx" onClick="javascript:return EJEJC_lc(this);"><img src="http://www.e-junkie.com/ej/ej_view_cart.gif" border="0" alt="View Cart"/></a>
</p>
<?php } ?>

(remember not to just cut and paste the code above because your code will be different )

That's it! in any post, if you put an E-Junkie item no (from your item's button code) in your new custom field, the buttons will magically appear. And if you don't - they won't!



Hey, it works for me anyway!


#
POSTED ON: November 6, 2009 @ 06:32 GMT -7




E-junkieChef
E-Junkie Crew
Posts: 922


Thanks for sharing the solution!


#
POSTED ON: November 6, 2009 @ 17:13 GMT -7


You must be logged in to make a post. Please click here to login.

PayPal Certified Integration Google Checkout Certified Integrattion 30 Day Money Back Guarantee Slam the Online Scam
 Share this page!