Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Is it possible to edit the title of products from a script?


screenway11

Recommended Posts

Hi, I've been trying to fix the alignment of buttons on an apple store, I found that putting <br> in the title for the product information aligns the buttons perfectly, as when the product has two lines of text, it pushes the buttons location down a margin.. so when it's next to a product with only one line of text, it looks correctly aligned. The problem is that whn you hover the mouse cursor over the products image, the "<br>" tag shows in the title as seen below:

 

24z8upv.jpg

I don't want this to happen, is it possible to remove that "<br>" tag from the title, but still keep it there in the code? I found nothing in the index.php script, is there some other script I could look at?

Link to comment
Share on other sites

If that <br> helps you, then you should put it into the script at the place where the product name is printed to the screen, not add it to each product name

 

I would do this in includes/modules/product_listing.php

Link to comment
Share on other sites

thanks for pointing out the relevant script, I didn't know which one it was

 

But, the problem is that I only want the <br> to take effect on some products and not all of them, for example I don't want any <br> tag on a product which has two lines of text in its title. So that's what I felt like I needed to zone in on the products individually. But I guess what i'm trying to do is probably not possible with oscommerce since I don't have access to a complete html script of the site..

Link to comment
Share on other sites

You have full access to all files of the store, there are no html files in osCommerce, they are all php, the html comes from there.

 

It is possible of course to do what you need, a function you'd pick each title tag, clean it and place it back again, this would be a waste of resources I think

 

I think that your approach is wrong: You have a styling/aligment problem. This should not be solved by adding stuff to where it doesn't belong, but by fixing the styling problem

 

It is maybe just symptomatic that the issue get solved by adding a <br>, a real solution would look different.

 

How? I don't know, impossible to say by looking at the image. Could be some floating issue or whatever, or even a mistake in the markup.

 

It look like you use a ready made template, did you contact the template maker/seller about the issue?

Link to comment
Share on other sites

I think you're right, and I was thinking that it could possibly work if i put a margin-bottom spacing at the correct part of whichever script, I've no idea where to edit the script though, didn't contact anyone...probably should...

 

 

the package is oscommerce v2.2 for the record...old I know...

Link to comment
Share on other sites

the buttons file name is button_in_cart.gif

 

and I found this in the product_listing.php script

 

 

case 'PRODUCT_LIST_BUY_NOW':
$button = (LISTING_BUTTON == 'buy now' ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_in_cart.gif',
IMAGE_BUTTON_BUY_NOW, 'class="buy_now"') . '</a> ' : (strstr(LISTING_BUTTON, 'buy now') ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'class="buy_now"') . '</a> ' : '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS, 'class="buy_now"') . '</a> ' ));
$lc_align = 'center';
$lc_text = $button;
break;

 

I have close to zero knowledge of PHP unfortunately, and I don't know if it's possible to put a margin spacing in there somewhere between the products title text and the "add to cart" button

Link to comment
Share on other sites

woohoo I got it. Thanks for guiding me on which script it was. Trial & error is usually what it comes down to ;p

 

 

 

if ($addimages) {
$image_query = tep_db_query( "SELECT ai.medium_images, ai.images_description, ai.popup_images, p.products_image_med, p.products_image_description FROM " . TABLE_ADDITIONAL_IMAGES . " ai, " . TABLE_PRODUCTS . " p WHERE ai.products_id=p.products_id and ai.products_id = '".(int)$products['products_id']."'");
$selected_image = tep_db_fetch_array($image_query);
$image = ($selected_image['medium_images'] ? $selected_image['medium_images'] : ($selected_image['products_image_med'] ? $selected_image['products_image_med'] : ($selected_image['popup_images'] ? $selected_image['popup_images'] : $products['products_image'])));
}
$image = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $image, ($addimages ? (tep_not_null($selected_image['images_description']) ? $selected_image['images_description'] : (tep_not_null($selected_image['products_image_description']) ? $selected_image['products_image_description'] : $products['products_name'])) : $products['products_name']), PRODUCT_IMAGE_WIDTH, '') . '</a>' . '<div style = "margin-bottom: -80px;">';
$buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif');
$button = (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW ? (LISTING_BUTTON == 'buy now & details' ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"') . '</a> <span class="buy_now">|</span> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image_button('button_details_small.gif', IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a><br><br>' : (strstr(LISTING_BUTTON, 'buy now') ? '<br><br><br><br><br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW) . '</a><br><br>' : '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . '</a><br><br>' )) : ' '); 

 

 

I put a <div style = "margin-bottom: -80px;"> in place of a <br> and then put a few more line margins after (strstr(LISTING_BUTTON, 'buy now')

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...