www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 24

Thread: I managed to break...

  1. #1
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    I managed to break...

    my related products section and i didn't notice it right away.. been making lots of changes... any ideas would be helpful... It's an old custom CMS that constantly is breaking ... ehhh

    If you look at this page towards the bottom you will see products that are recommended and a break in the sequence.

    http://www.skincareheaven.com/produc...hten_Up_SPF_15


  2. #2
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    I guess posting the code would probably help.. doh!

    <?php
    $sql="select * from related_product where product_id='". $product_id ."'";
    $exeRelated_product_id = mysql_query($sql) or die(mysql_error());
    if($rsRelated_product_id = mysql_fetch_array($exeRelated_product_id))
    $related_product_id=$rsRelated_product_id['related_product_id'];

    $arrRelated_product_id=explode(",",$related_product_id);
    foreach ($arrRelated_product_id as $s)
    {
    $related_product_id_link[]=$s;
    $sql="select * from product_master where product_id='".$s."'";
    $exeRelated_product_list = mysql_query($sql) or die(mysql_error());
    if($rsRelated_product_list = mysql_fetch_array($exeRelated_product_list))
    {
    //$image_path=getProductImage($rsRelated_product_list['product_id']);

    $image_name = $obj_product->is_exists_image($rsRelated_product_list['product_id']);

    if($image_name && file_exists("productImages/".$image_name))
    $image_path="productImages/".$image_name;
    else
    $image_path="productImages/not_available.gif";
    list($width, $height, $type, $attr)=@getimagesize("productImages/".$image_path);

    ?>


    <div class="other_product_box right_border center">
    <h5>
    <a href="product_detail.php?product_name=<?=preg_replace("/ /","_",trim($rsRelated_product_list['product_name']));?>" class="link_none dark_green"><? echo stripslashes($rsRelated_product_list['product_name']);?> </a>
    </h5>

    <img src="get_image.php?pic=<?=$image_path?>&ht=<?=121?>&wd=<?=121?>" title="<?=$rsRelated_product_list['product_name']?>" alt="<?=$rsRelated_product_list['product_name']?>" />

    </div>

  3. #3
    Join Date
    Jun 2011
    Location
    California
    Posts
    383
    or perhaps just a way to limit the amount showing to 9.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,241
    Quote Originally Posted by Supplement View Post
    or perhaps just a way to limit the amount showing to 9.
    That part is easy: add a "LIMIT 9" to the end of the query. Otherwise, a quick scan makes me think it's more a HTML/CSS issue, but like I said, that's just a quick glance.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    Another quick glance using Chrome's Inspector tool shows that some items are slightly taller than others: 199px versus 183px. Those that are taller have long names that consume 3 lines of text, rather than the normal 2.

    Shorten the names, make the font size smaller, or put the product title in a DIV with a static size and overflow set to hidden, however you choose to solve it. I'm 95.8% sure that's the issue.
    Jon Wire

    thepointless.com | rounded corner generator

    I agree with Apple. Flash is just terrible.

    Use CODE tags!

  6. #6
    Join Date
    Jun 2011
    Location
    California
    Posts
    383
    Thanks guys, got it fixed for the most part... Just need to work on a few other things now.

    I really appreciate the help.

    =)

  7. #7
    Join Date
    Apr 2011
    Posts
    17
    What CMS are you using ?

  8. #8
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Smile

    Quote Originally Posted by Wanda View Post
    What CMS are you using ?

    It's a custom built CMS. php, javascript and jquery, linux (ubuntu) mysql database. It's lovely when it wants to be, but has it's moments when it's tempermental... hehe

  9. #9
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Red face

    Quote Originally Posted by NogDog View Post
    That part is easy: add a "LIMIT 9" to the end of the query. Otherwise, a quick scan makes me think it's more a HTML/CSS issue, but like I said, that's just a quick glance.
    So I've been messing around with this LIMIT statement but can't seem to get it to work.

    Could you help me with the syntax?

    I inserted it like so..

    $sql="select * from related_product where product_id='". $product_id ."' 'LIMIT 8'";
    $exeRelated_product_id = mysql_query($sql) or die(mysql_error());
    if($rsRelated_product_id = mysql_fetch_array($exeRelated_product_id))
    $related_product_id=$rsRelated_product_id['related_product_id'];

    $arrRelated_product_id=explode(",",$related_product_id);
    foreach ($arrRelated_product_id as $s)
    {
    $related_product_id_link[]=$s;
    $sql="select * from product_master where product_id='".$s."' 'LIMIT 8'";
    $exeRelated_product_list = mysql_query($sql) or die(mysql_error());




    It didn't work..

  10. #10
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,241
    No SQL single-quotes around the LIMIT clause (just the PHP double-quotes).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  11. #11
    Join Date
    Jun 2011
    Location
    California
    Posts
    383
    Just tried it like this:

    $sql="select * from related_product where product_id='". $product_id ."' LIMIT 8";
    $exeRelated_product_id = mysql_query($sql) or die(mysql_error());
    if($rsRelated_product_id = mysql_fetch_array($exeRelated_product_id))
    $related_product_id=$rsRelated_product_id['related_product_id'];

    $arrRelated_product_id=explode(",",$related_product_id);
    foreach ($arrRelated_product_id as $s)
    {
    $related_product_id_link[]=$s;
    $sql="select * from product_master where product_id='".$s."' LIMIT 8";
    $exeRelated_product_list = mysql_query($sql) or die(mysql_error());

    no dice! any other bits of help would be appreciated.

  12. #12
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    Isn't the LIMIT suggestion just a means of circumventing the underlying layout issue anyway? If that's the case, it could very well break again if your product list changes, and could very well just move the breakage from page 1 to page 2.
    Jon Wire

    thepointless.com | rounded corner generator

    I agree with Apple. Flash is just terrible.

    Use CODE tags!

  13. #13
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Angry

    Quote Originally Posted by svidgen View Post
    Isn't the LIMIT suggestion just a means of circumventing the underlying layout issue anyway? If that's the case, it could very well break again if your product list changes, and could very well just move the breakage from page 1 to page 2.
    Hi Svidgen,

    Actually I got the layout issues just about fixed, I more or less want to limit the suggestions because there is just to many. I think most stores list about 8 suggestions on a page, on some of my pages it lists like 20 suggestions, it's just entirely to many. ack!

  14. #14
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Thumbs up

    I've tried AND LIMIT and a few other things with no avail..

    still looking for some help if anyone is interested in helping.

    cheers!

  15. #15
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Lightbulb

    help help help. please..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles