Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product listing strip_tag


Guest

Recommended Posts

I use osCommerce 2.3.4.1 CE Boot strap version

I need to show a player on the list view version of the productlisting like this

list2.jpg.63d8b64e45e93f1a5d7a06620f180f57.jpg

 

In proct info I insert the code

<AUDIO controls><SOURCE type="audio/mpeg" src="https://www.something.se/some/song1.mp3"></AUDIO>

But there is the strip_tags code, how can I change this so the mp3 player shows in product listing, I guess the code in the file is

    $prod_list_contents .= '      <p class="group inner list-group-item-text" itemprop="description">' . strip_tags($listing['products_description'], '<br>') . '&hellip;</p><div class="clearfix"></div>';

 

 

Link to comment
Share on other sites

try:

    $prod_list_contents .= '      <p class="group inner list-group-item-text" itemprop="description">' . $listing['products_description'] . '&hellip;</p><div class="clearfix"></div>';

But be aware that the description is also shortened to 20 words in the products queries:

$listing_sql = "select p.products_model, pd.products_name, m.manufacturers_name, p.products_quantity, p.products_image, p.products_weight, p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description,.......

Depending on your Store version you'll find the queries in index.php or if modularized in the content module: includes/mnodules/content/index_products/cm_ip_product_listing.php

If you need the complete description change the above in all queries to:

$listing_sql = "select p.products_model, pd.products_name, m.manufacturers_name, p.products_quantity, p.products_image, p.products_weight, p.products_id, pd.products_description,.......

 

Link to comment
Share on other sites

The code in question is intended to offer a short "teaser" from the full product description. This involves taking only a few (20) words and stripping out all HTML tags. If you don't want to lose the audio player, but want to keep the "teaser" functionality for other products, you might be able to add code to check if the audio player is being requested (preg_match call looking for the audio tag), and if it is, don't strip tags. You might have to get the full product description for all products, and only for non-audio player do you trim it down after stripping tags.

strip_tags() has a list of tags to exclude, so you might be able to use that (but without other changes, it might have already been cut down too much). For any product, you might want to keep simple in-line tags like <i> and <b> (as well as the audio player tags)... it's really the major block stuff you want to kill.

Anyway, there are a bunch of issues to be aware of, and a number of approaches you could take.

Link to comment
Share on other sites

Another, cleaner aproach would be to add the player code to the product listing and use an additional field to hold the audio filename.

You would need to add the field to the product table in the database and coding to enter the filename in admin/categories.php

Link to comment
Share on other sites

1 hour ago, raiwa said:

$prod_list_contents .= ' <p class="group inner list-group-item-text" itemprop="description">' . $listing['products_description'] . '&hellip;</p><div class="clearfix"></div>';

Thank you! That worked.

It is only the player in every product so the short 20 word is ok.

Link to comment
Share on other sites

1 hour ago, MrPhil said:

The code in question is intended to offer a short "teaser" from the full product description. This involves taking only a few (20) words and stripping out all HTML tags. If you don't want to lose the audio player, but want to keep the "teaser" functionality for other products, you might be able to add code to check if the audio player is being requested (preg_match call looking for the audio tag), and if it is, don't strip tags. You might have to get the full product description for all products, and only for non-audio player do you trim it down after stripping tags.

strip_tags() has a list of tags to exclude, so you might be able to use that (but without other changes, it might have already been cut down too much). For any product, you might want to keep simple in-line tags like <i> and <b> (as well as the audio player tags)... it's really the major block stuff you want to kill.

Anyway, there are a bunch of issues to be aware of, and a number of approaches you could take.

There is no other products than the songs and only the player in description so it s no problem.

Link to comment
Share on other sites

add the code to retrieve the description and to show it to the bestseller box.

You have the example in index/product listing and in product_info.php

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...