Jump to content

Recommended Posts

I think i figured it out.

 

In /includes/modules/content/index/cm_i_featured_products.php

 

Find:

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

Replace With:

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

change md-4 to whatever number you like. Lower means more columns.

 

Amateur here so just learning as i go. Tsimi please verify if i am correct or wrong.

 

Thanks

Share this post


Link to post
Share on other sites

Yeah, that is the way to do it.

Some addons allow you to set that number in the module setup. I didn't implement it though.

Your code looks good.

 

And no negative effect.

Edited by Tsimi

Share this post


Link to post
Share on other sites

hello @@Tsimi

 

what am I supposed to fill in Expiry date for Featured Product if I want to make some product will featured forever. I try to put it blank like we use to do in special product but some error message coming..

 

rgds,

pit

Share this post


Link to post
Share on other sites

@@webmasterpitoyo

 

Hi pit

 

Usually you just keep that field empty.

 

What error message do you get?

What osC version do you use?

Edited by Tsimi

Share this post


Link to post
Share on other sites

@@Tsimi , tx for the respons

 

If I leave the expiry date empty, then the whole admin page become blank and get the error:

 

---------------

1292 - Incorrect datetime value: '' for column 'expires_date' at row 1

insert into featured (products_id, featured_date_added, expires_date, status) values ('39', now(), '', '1')

[TEP STOP]

------------------

 

I use the OSC 2.3.4 BS Edge download at jun 2016.

 

thanks,

rgds,

pit

Share this post


Link to post
Share on other sites

@@webmasterpitoyo

 

Hi pit

 

I just downloaded and installed a fresh copy of osC Edge on my local server and then I installed the Featured Products BS addon.

I have no problems at all to add or remove products on the featured products page. I kept the expire date field empty.

Have you touched the database prior to installation? Maybe while installing a different addon?

Can you please try to install this again in a fresh copy of Edge?

 

Regards
Lambros

Edited by Tsimi

Share this post


Link to post
Share on other sites

Uploaded a new version of the addon.

 

http://addons.oscommerce.com/info/9355

 

The latest EDGE version seems to be a bit different so it requires a new module (index_nested) and some code changes are not needed anymore.

Therefore I created 2 separate packages with two separate install manuals for EDGE and GOLD. Also added those php7 fixes to the modules.

Share this post


Link to post
Share on other sites

dear @@Tsimi

 

Im sorry maybe Im still in 'elementery school' for this php things  :) , but I just comparing the file between catalog/admin/featured.php (from this add on) and catalog/admin/specials.php (from native osc2.3.4 BS edge).. there is a different script for handling inserting value to the db table for expiry date (I put it on bold):

 

in featured.php:

tep_db_query("insert into featured (products_id, featured_date_added, expires_date, status) values ('" . $_POST['products_id'] . "', now(), '" . $expires_date . "', '1')");

 

in specials.php:

tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . ", '1')");

 

does it have any correlation with the error I get?

kindly advise,

thanks,

rgds,

pit

Share this post


Link to post
Share on other sites

@@webmasterpitoyo

 

Hmmm...it looks like something doesn't allow an empty value.

Let me try quickly something..... be right back....

Edited by Tsimi

Share this post


Link to post
Share on other sites

@webmasterpitoyo

 

pit

 

can you access once your database via phpMyadmin and take a look at the featured table?

Tell me if the field expires_date has set NULL set to Yes or No

Edited by Tsimi

Share this post


Link to post
Share on other sites

@@webmasterpitoyo

 

Can you try the following.

 

Open your admin/featured.php file and look for the following code around line 36

$expires_date = '';
if (tep_not_null($expdate)) {
$expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2);
}

replace that with this

if (!isset($expires_date) || $expires_date == '') {
$expires_date = NULL;
} else {
$expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2);
}

Share this post


Link to post
Share on other sites

dear @@Tsimi

 

yes! for a new featured product.. this solution is solve..

but I try for an updating one featured product and revise expiry date with an empty fill, there is an error:

----

1292 - Incorrect datetime value: '' for column 'expires_date' at row 1

update featured set featured_last_modified = now(), expires_date = '' where featured_id = '9'

[TEP STOP]

------

 

thanks,

rgds,

pit

Share this post


Link to post
Share on other sites

did you check your featured table in the database already?

What does it say for the field expires_date?

Edited by Tsimi

Share this post


Link to post
Share on other sites

 

@@webmasterpitoyo

 

Can you try the following.

 

Open your admin/featured.php file and look for the following code around line 36

$expires_date = '';
if (tep_not_null($expdate)) {
$expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2);
}

replace that with this

if (!isset($expires_date) || $expires_date == '') {
$expires_date = NULL;
} else {
$expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2);
}

sorry.. I am not try yet this change.. I have something to do first.. back maybe in some hours..

 

rgds,

pit

Share this post


Link to post
Share on other sites

for the update try this

 

find this code on line 53

	$expires_date = '';
        if (tep_not_null($expdate)) {
          $expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2);
        }

replace with this

        if (!isset($expdate) || $expdate == '') {
            $expires_date = NULL;
        } else {
            $expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2);
        }

Share this post


Link to post
Share on other sites

Dear @@Tsimi

 

I tried your suggestion above changing line 36 and 53.. but both not work.. still error coming whether it is a new featured product or updating the expiry date..

 

I just try my way (only I dont now if this changing is a good solution or not), with:

 

on line 42

tep_db_query("insert into featured (products_id, featured_date_added, expires_date, status) values ('" . $_POST['products_id'] . "', now(), '" . $expires_date . "', '1')");

change with

tep_db_query("insert into featured (products_id, featured_date_added, expires_date, status) values ('" . $_POST['products_id'] . "', now(), " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . ", '1')");

and for updating on line 54

tep_db_query("update featured set featured_last_modified = now(), expires_date = '" . $expires_date . "' where featured_id = '" . $_POST['featured_id'] . "'");

change with

tep_db_query("update featured set featured_last_modified = now(), expires_date = " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . " where featured_id = '" . $_POST['featured_id'] . "'");

with this changing.. I try to simulate for a new featured product or an updating with an empty expiry date, both is working fine..

 

pls comment for this,

thanks,

rgds,

pit

Share this post


Link to post
Share on other sites

@webmasterpitoyo

 

pit

 

can you access once your database via phpMyadmin and take a look at the featured table?

Tell me if the field expires_date has set NULL set to Yes or No

 

I check the database for last success simulaton resulting NULL in field expres_date

Share this post


Link to post
Share on other sites

@@webmasterpitoyo

 

Your code changes look good to me.

If that works for you then use it.

 

Add a new product, update the date and then go check the database. Try adding a new product with date and without also try to update a product by adding a new date or deleting the date.

While you do that always go check the database if the products date is getting updated.

Share this post


Link to post
Share on other sites

@webmasterpitoyo

 

pit

 

can you access once your database via phpMyadmin and take a look at the featured table?

Tell me if the field expires_date has set NULL set to Yes or No

@@Tsimi

actually I dont really understand what your question mean .. this attached I show you the dump sgl file for featured table..

-- phpMyAdmin SQL Dump
-- version 4.0.10.14
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Jul 13, 2016 at 09:32 PM
-- Server version: 5.6.30
-- PHP Version: 5.4.31

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

CREATE TABLE IF NOT EXISTS `featured` (
  `featured_id` int(11) NOT NULL AUTO_INCREMENT,
  `products_id` int(11) NOT NULL DEFAULT '0',
  `featured_date_added` datetime DEFAULT NULL,
  `featured_last_modified` datetime DEFAULT NULL,
  `expires_date` datetime DEFAULT NULL,
  `date_status_change` datetime DEFAULT NULL,
  `status` int(1) DEFAULT '1',
  PRIMARY KEY (`featured_id`),
  KEY `idx_products_id` (`products_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=12 ;

INSERT INTO `featured` (`featured_id`, `products_id`, `featured_date_added`, `featured_last_modified`, `expires_date`, `date_status_change`, `status`) VALUES
(9, 51, '2016-07-13 14:37:16', '2016-07-13 21:13:01', NULL, NULL, 1),
(10, 54, '2016-07-13 16:52:11', NULL, NULL, NULL, 1),
(11, 61, '2016-07-13 21:12:51', NULL, NULL, NULL, 1);

rgds,

pit

Share this post


Link to post
Share on other sites

When you access your database via phpMyAdmin you should see something like this.

 

post-27491-0-43933100-1468421247_thumb.jpg

 

But it looks like it is set to Yes so it is good there. No idea why you have/had trouble with the date of this addon.

But now it seems to work right? So all is good then. :thumbsup:

Edited by Tsimi

Share this post


Link to post
Share on other sites

@@Tsimi

 

I was just wondering if you know how to change the code to show 3 products in the info box instead of just 1.

 

Back in the old days of 2.2 I used a while loop which is I presume how it would be done today, I have tried to implement the code but keep breaking it lol

 

Thanks

 

M


Bootstrap 3 ROCKS!

(or it will if I ever get my head around it lol)

(and I think I have now (w00t) )

Share this post


Link to post
Share on other sites

@@PupStar

 

Hi Mark

 

How exactly should the products show? As a slider?

 

@@Tsimi,

 

No slider as I dont really like scrolling boxes, basically 1 vertical column of 3 products

 

Product 1

Product 2

Product 3

 

If that makes sense

 

Thanks

 

M


Bootstrap 3 ROCKS!

(or it will if I ever get my head around it lol)

(and I think I have now (w00t) )

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

×