grucker Posted December 23, 2009 Report Share Posted December 23, 2009 Good morning and merry Christmas to you all. I have eventually finished the paypal course that I purchased from Killer sites and everything works, I also understand upto a point what I have been taught. Two slight problems. The only way I can find to insert an alternate text to the images is in the templates page and then only one appears everywhere so I had to make it a catch all of product image which although it verifies is less than ideal. Also I am struggling to come to grips with showing the products on more than one row. every time I add a product it goes next to the previous and eventually everything distorts. Kindest regards David Quote Link to comment Share on other sites More sharing options...
falkencreative Posted December 23, 2009 Report Share Posted December 23, 2009 Alternate text issue: I personally haven't worked through this course, so I'm using the finished sample code that was included with the course. You should have a function named "render_products_from_XML()" within "templates.php" in the functions folder. Should look roughly like this: If you change this line (that renders the product image): "" to That should add an alt attribute that matches the product title. Alternately, you could add an additional row in your XML file specifically for the alt attribute on the product images, but then you'll also need to write all the PHP to get that information from the XML file. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted December 23, 2009 Report Share Posted December 23, 2009 Showing products in more than one row: Well, you'll probably need to modify your render_products_from_XML() function again. Basically, you need to add a counter to your loop that displays each of the products, and add one to it every time a product gets displayed. Once the loop hits a certain number (the number of items you want displaying in a row - my example defaults to 3) it closes the (table row) and adds a new one. Something like this: >function render_products_from_XML() { // starts the product table $output = "</pre> <table class="products">"; // sets loop to 0 $i = 0; // starts looping through products foreach (get_xml_catalog() as $product) { $output .= ' ' . $product->title . ' ' . $product->description . ' $' . $product->price .' Add to Cart '; // checks the loop. If it's >= 2 (indicating that it's looped 3 times)... if ($i >= 2){ // start new row $output .= ""; // reset loop $i = 0; } // if not, add one to the loop else $i++; } // adds in extra blank s if there aren't enough products to completely // fill up the table if ($i == 1) $output .= ''; else if ($i == 2) $output .= ''; // finishes table $output .= '</table>';<br><br> return $output Quote Link to comment Share on other sites More sharing options...
grucker Posted December 24, 2009 Author Report Share Posted December 24, 2009 Thank you for your reply. I will try this soon and let you know. I am still not thinking php, as soon as you mentioned I the alt image code I realised that, so at least it may be slow but with your help I am slowly getting it. Thanks again, Regards, David Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.