Jump to content

Recommended Posts

@raiwa

I can confirm the delete button is missing in all versions from the early times. The delete confirm button only is there.
Not sure how I could loose a button or wasn't there one from the very beginning? Not sure.. ūü§Ē

Share this post


Link to post
Share on other sites

@Yepi.

Sorry, must be this code, I forgot the fid. Please add this instead of the above posted:

						if (isset($_GET['fID'])) {
						  echo '<a href="' . tep_href_link('featured.php', 'page=' . $_GET['page'] . '&action=delete&fID=' . $_GET['fID']) . '">' . tep_draw_button(IMAGE_DELETE, 'minus') . '</a>';
						}

 

Share this post


Link to post
Share on other sites
30 minutes ago, Tsimi said:

@raiwa

I can confirm the delete button is missing in all versions from the early times. The delete confirm button only is there.
Not sure how I could loose a button or wasn't there one from the very beginning? Not sure.. ūü§Ē

Maybe it wasn't there since the earlier versions already. Never noticed this neither others reported. Seems no one missed it ūüėČ

Share this post


Link to post
Share on other sites

@Yepi, @Tsimi,

The very correct thing seems to be this:

						echo '<a href="' . tep_href_link('select_featured.php', 'page=' . $_GET['page'] . '&action=new') . '">' . tep_draw_button(IMAGE_SEARCH, 'search') . '</a>';
						echo '<a href="' . tep_href_link('featured.php', 'page=' . $_GET['page'] . '&action=new') . '">' . tep_draw_button(IMAGE_NEW_PRODUCT, 'plus') . '</a>';
						echo '<a href="' . tep_href_link('featured.php', 'page=' . $_GET['page'] . '&action=delete&fID=' . $fInfo->featured_id) . '">' . tep_draw_button(IMAGE_DELETE, 'trash') . '</a>';

Like this the button acts always on the selected product, even on first time page load when the first product is selected by default.

Please confirm

Edited by raiwa

Share this post


Link to post
Share on other sites

@raiwa

Yeah that works. Even after page load when the top product is selected by default it does work. :thumbsup:

Edited by Tsimi

Share this post


Link to post
Share on other sites

Updated Version uploaded:

Changes version 1.6.1.:        
 - Added missing "Delete" button in admin/featured.php

All versions updated (GOLD, EDGE and CE FROZEN)

https://apps.oscommerce.com/TyAIr&amp;featured-products-bs

Share this post


Link to post
Share on other sites

@Tsimi

hi Lambros,

I'm trying to add a modification to the modules for this addon, where the "See More" button does not display unless there are more featured products listed than are limited to display at any one time. ..because there is no point is sending the customer to the featured products page if they are seeing all of the featured products on whatever page they are on.

The problem I'm having is getting the total number of featured products (for lets say, the index page module). It's probably right in front of me, I'm just missing that piece. For example: I condition to display that "See More" button only when the total number of featured products is > MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_CONTENT_LIMIT.

I wanted to use tep_db_num_rows($featured_products_query), but that is set in the $query to always equal the content limit setting.

I really appreciate any help on this. And it could be a good feature for an update. I'll gladly share it here once I get that mod working properly.

 


osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Share this post


Link to post
Share on other sites

@Demitry

I did something similar long time ago for my specials on the index page. Show a certain amount of specials on the index page and a button that says Show All which redirects to the specials.php page.
I will have to dig it out since I don't remember which shop I did that for.

Give me some time and I'll get back to you.

Share this post


Link to post
Share on other sites

@Tsimi

yeah, no rush, whenever you can.

The "See More" button for the featured products is already there. I'm just trying to condition it to only display when there are more products listed than are limited to display.

I really just need to figure out how to get the total featured products listed. Once I have that key, the rest is cake.

 


osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Share this post


Link to post
Share on other sites

@Demitry

Ok, I had a look at my specials code and it is not what you are looking for. Actually it is same as the see more button currently inside the Featured Products BS add-on.
But I started to do some research and found a solution. It was easier than I thought.

You need to use a select count(*) query to get the current total amount of featured products and you only want to get the ones that are set to f.status 1
So this is what I came up with

Open your index module featured file

FIND:

if (tep_db_num_rows($featured_products_query) > 0) { // Show only if we still have products in the array

ADD BEFORE:

$featured_count_query = tep_db_query("select count(*) as total from featured WHERE status = '1'");
$featured_count = tep_db_fetch_array($featured_count_query);


Now you can use this here to hide/show the button.

if ($featured_count['total'] > MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_CONTENT_LIMIT) {
BUTTON CODE HERE
}

Let me know if that works for you.

Edited by Tsimi

Share this post


Link to post
Share on other sites

@Tsimi

...you put the "bro" in Lambros

ūüėÄ

yeah man, ..that's exactly what I was trying to achieve and I'm not very good with SQL. Thank you for the help. I just tested this mod and it works as it should. If you want, you can add it to the next update release.

Ok, so here is the complete mod to only show the "See More" button when the number of Featured Products exceeds the content limit set in admin for the particular module.

I'm just going to use the index module for this sample, and this is for BS Edge. I'm not sure if there is a difference with other versions.

/index/modules/content/index/cm_i_featured_products.php

1)      FIND this code:

        if (tep_db_num_rows($featured_products_query) > 0) { // Show only if we still have products in the array

ADD just ABOVE it:

        // this will show/hide the "See More" button
        $fp_count_query = tep_db_query("select count(*) as total from featured WHERE status = '1'");
        $fp_count = tep_db_fetch_array($fp_count_query);
        $fp_btn = 'style="display:none;"';
        if ($fp_count['total'] > MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_CONTENT_LIMIT) {
            $fp_btn = 'style="display:inline;"';
        }

 

2)      FIND this code:

            $featured_products_content = '<h3>' . ($cat_name != '' ? sprintf(MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_CATEGORY_TITLE, $cat_name) : MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_TITLE . ((MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_SHOW_BUTTON == 'True')? '  ' . tep_draw_button(MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_IMAGE_BUTTON_SEE_MORE, 'glyphicon glyphicon-triangle-right', tep_href_link('featured_products.php'), 'primary', null, 'btn-default btn-sm'):'')) . '</h3>';

REPLACE it with this:

            $featured_products_content = '<h3>' . ($cat_name != '' ? sprintf(MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_CATEGORY_TITLE, $cat_name) : MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_TITLE . ((MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_SHOW_BUTTON == 'True')? '&nbsp;&nbsp;<span ' . $fp_btn . '>' . tep_draw_button(MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_IMAGE_BUTTON_SEE_MORE, 'glyphicon glyphicon-triangle-right', tep_href_link('featured_products.php'), 'primary', null, 'btn-default btn-sm') . '</span>':'')) . '</h3>';

 

 

Edited by Demitry

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Share this post


Link to post
Share on other sites

Is it possible for this module to display, in the central area, 4 products across one row on a PC, but only 2 products on a phone screen size? This is so customer does not have to scroll down so far to find other content when using a phone.


OsC 2.3.4.1 CE Frozen   PHP 7.2   MySQL 10.1.36-MariaDB-cll-lve

Share this post


Link to post
Share on other sites
3 hours ago, mhsuffolk said:

Is it possible for this module to display, in the central area, 4 products across one row on a PC, but only 2 products on a phone screen size? This is so customer does not have to scroll down so far to find other content when using a phone.

tpl_cm_in_featured_products.php

You would have to replace

<div class="col-sm-<?php echo $content_width; ?> cm-i-featured_products">

with:

<div class="col-sm-6 col-lg-3 cm-i-featured_products">

or recode the module.

 

Share this post


Link to post
Share on other sites
31 minutes ago, Hotclutch said:

tpl_cm_in_featured_products.php

You would have to replace


<div class="col-sm-<?php echo $content_width; ?> cm-i-featured_products">

with:


<div class="col-sm-6 col-lg-3 cm-i-featured_products">

or recode the module.

 

I would say it should be (with the module width set to 3 cols:

<div class="col-sm-<?php echo $content_width; ?> col-xs-6 cm-i-featured_products">

or:

<div class="col-sm-3 col-xs-6 cm-i-featured_products">

 

Share this post


Link to post
Share on other sites

you can leave the code in place if you want and put it like this:

<div class="col-sm-<?php echo $content_width; ?> col-lg-3 cm-i-featured_products">

OR

<div class="col-sm-<?php echo $content_width; ?> col-xl-3 cm-i-featured_products">

 

Share this post


Link to post
Share on other sites

@raiwa @Hotclutch Thank you for your suggestions. Perhaps I did not explain clearly. Your mod alters the width of each products display. What I wanted to change was the quantity that is displayed. 4 featured products on a big screen, but only two featured products on a phone. This is only to apply to the index page.


OsC 2.3.4.1 CE Frozen   PHP 7.2   MySQL 10.1.36-MariaDB-cll-lve

Share this post


Link to post
Share on other sites

Then it's not clear.

big screen implies col-lg-... or col-xl-...

the only way you can have 4 on a row is to specify col-3, i.e col-lg-3 or col-xl-3

also what is the resolution of the phone? are you using bootstrap 3 or 4?

the only way you can have 2 on a row is to specify col-6, i.e col-sm-6 or col-md-6. col-xs is deprecated in bootstrap 4.

If you mean set a maximum of 4 on big screen and 2 on small screen,  then this is not possible without rewriting the code.

Share this post


Link to post
Share on other sites
32 minutes ago, Hotclutch said:

If you mean set a maximum of 4 on big screen and 2 on small screen,  then this is not possible without rewriting the code

Yes, that is what I am trying to achieve.


OsC 2.3.4.1 CE Frozen   PHP 7.2   MySQL 10.1.36-MariaDB-cll-lve

Share this post


Link to post
Share on other sites

Try the following:

- before the while loop define a counter: $i=0;
- at the end of the while loop increase the counter: $i++;
- at the beginning of the loop, condition a variable which holds xs  helper class:

if ($i > 2) {
	$xs_class = 'hidden-xs';
} else {
	$xs_class = '';
}

add the variable to the product div:

        		$featured_products_content .= '  <div class="col-sm-6 col-md-3 ' . $xs_class . '">';

This is for BS3. For BS 4 use the equivalent of "hidden-xs".

Edited by raiwa

Share this post


Link to post
Share on other sites

xs and hidden are deprecated classes in BS4

you have to use a combination of these classes:

Hidden on all .d-none
Hidden only on xs .d-none .d-sm-block
Hidden only on sm .d-sm-none .d-md-block
Hidden only on md .d-md-none .d-lg-block
Hidden only on lg .d-lg-none .d-xl-block
Hidden only on xl .d-xl-none
Visible on all .d-block
Visible only on xs .d-block .d-sm-none
Visible only on sm .d-none .d-sm-block .d-md-none
Visible only on md .d-none .d-md-block .d-lg-none
Visible only on lg .d-none .d-lg-block .d-xl-none
Visible only on xl .d-none .d-xl-block

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×