Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2006
    Posts
    110
    Plugin Contributions
    0

    Default Stuck deep in php - where to add <div>?

    Hi all.

    I''ve modified product_listing.php to have a style called listingPrice like this:

    (around line 110)

    $lc_text = $lc_price;

    to

    $lc_text = '<div class="listingPrice">' . $lc_price . '</div>';

    Now I don't really understand what the code does, but this works for me.

    However, I would like to do a simliar mod with the 'add (0)' box as seen here:

    http://www.towertothepeople.co.uk/sh...=index&cPath=1

    I want to apply a style, called 'listingAdd' (or whatever) by modifying the code in a similar way to above. Trouble is, that code is WAY more complicated, and has lots of conditional things going on.

    Can someone help me to decide where to put a <div> tag and an associated style within that code so that I can right justify that part of the listing.

    Thanks very much.

  2. #2
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Stuck deep in php - where to add <div>?

    The div class is already formated into the product listing you will just need to add the style to the style sheet.

    This is the section from the example site.

    .listingDescription {
    padding-left: .1em;
    padding-bottom: 2em;
    border-top: dashed #AA0000 1px;
    margin-left: 1em;
    }

    Just change the styles for your site.

  3. #3
    Join Date
    Aug 2006
    Posts
    110
    Plugin Contributions
    0

    Default Re: Stuck deep in php - where to add <div>?

    Thanks for the help, but that style doesn't apply to the bit I want to change. I've already modded .listingDescription as you've quoted, and that looks good.

    It's the part where the 'add' box appears that is too complicated for me to work out where to put <div>

    Cheers for trying though.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Stuck deep in php - where to add <div>?

    I checked it out yesterday and found that the stylesheet can move the input box to the right, but there is no handle with which to affect the Qty: text - that stays on the left.
    So it will require a new tag somewhere. Sorry, don't have time today to look for it. If you post the file section I might see something.

  5. #5
    Join Date
    Aug 2006
    Posts
    110
    Plugin Contributions
    0

    Default Re: Stuck deep in php - where to add <div>?

    Well it's a hell of a lot of code, but it's because it checks lot of things and gives alternatives depending on what options have been selected. So somewhere in all of this I want to add a <div> to move 'add' and the quantity box right!



    // more info in place of buy now
    $lc_button = '';
    if (zen_has_product_attributes($listing->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
    $lc_button = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
    } else {
    if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
    if (
    // not a hide qty box product
    $listing->fields['products_qty_box_status'] != 0 &&
    // product type can be added to cart
    zen_get_products_allow_add_to_cart($listing->fields['products_id']) != 'N'
    &&
    // product is not call for price
    $listing->fields['product_is_call'] == 0
    &&
    // product is in stock or customers may add it to cart anyway
    ($listing->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0) ) {
    $how_many++;
    }
    // hide quantity box
    if ($listing->fields['products_qty_box_status'] == 0) {
    $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
    } else {
    $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
    }
    } else {
    // qty box with add to cart button
    if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
    $lc_button= zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
    } else {
    $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
    }
    }
    }
    $the_button = $lc_button;
    $products_link = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
    $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
    $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');

    break;
    case 'PRODUCT_LIST_QUANTITY':
    $lc_align = 'right';
    $lc_text = $listing->fields['products_quantity'];
    break;
    case 'PRODUCT_LIST_WEIGHT':
    $lc_align = 'right';
    $lc_text = $listing->fields['products_weight'];
    break;
    case 'PRODUCT_LIST_IMAGE':
    $lc_align = 'center';
    if ($listing->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
    $lc_text = '';
    } else {
    if (isset($_GET['manufacturers_id'])) {
    $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a>';
    } else {
    $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a>';
    }
    }
    break;
    }

    $list_box_contents[$rows][$col] = array('align' => $lc_align,
    'params' => 'class="productListing-data"',
    'text' => $lc_text);
    }

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Stuck deep in php - where to add <div>?

    Assuming you only care about the particular case of the Add: [0] box, here is where that is generated:
    PHP Code:
                // hide quantity box
                
    if ($listing->fields['products_qty_box_status'] == 0) {
                  
    $lc_button '<a href="' zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' $listing->fields['products_id']) . '">' zen_image_button(BUTTON_IMAGE_BUY_NOWBUTTON_BUY_NOW_ALT'class="listingBuyNowButton"') . '</a>';
                } else {
                  
    $lc_button TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART "<input type=\"text\" name=\"products_id[" $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
                }
              } else {
    // qty box with add to cart button 
    TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART has the value "Add:".

    So I would say to put your div here:
    PHP Code:
                  $lc_button '<div class="listingAdd">' TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART "<input type=\"text\" name=\"products_id[" $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />" '</div>'
    Let me know how it works.

  7. #7
    Join Date
    Aug 2006
    Posts
    110
    Plugin Contributions
    0

    Default Re: Stuck deep in php - where to add <div>?

    Cool.
    Thanks for that.

 

 

Similar Threads

  1. Where is the closing div for #MainWrapper?
    By jami1955 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 24 Nov 2010, 01:00 AM
  2. Where's the Add to Cart: text in tpl_product_info_display.php?
    By datatv in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 12 Jun 2008, 02:24 AM
  3. Where is PHP code for Add-to-cart?
    By artcoder in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 27 Jul 2007, 05:36 AM
  4. Where are div id's declared
    By camioman in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 May 2006, 02:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg