Jump to content
KDM

Specials Maintenance - Administration

Recommended Posts

I created this program to help me keep better track of my Sale Specials. I found that the Oscommerce base Specials was limited in applying sales across the various manufacturers, categories and products.

 

**********************************************************************************************************************

 

This has been tested and is running on:

Apache2.

linux

PHP 5.2.+

MYSL 5.0.+

osCommerce Online Merchant v2.2 RC2a

 

I have a test machine also that is not on the web that runs:

Apache2.

window

PHP 5.2.+

MYSL 5.0.+

osCommerce Online Merchant v2.2 RC2a

 

I have not tested on other osCommerce version at this point.

 

**********************************************************************************************************************

 

contribution url: Specials Maintenance - Administration (add-on)

 

**********************************************************************************************************************

 

What this contribution should accomplish:

 

1) This contribution changes the way in which special pricing is handling by adding two new fields to the specials file:

a ) With both a start date and end date you can set up your special to start and end automatically. This is

accomplished via the function/special_maintenance.php program these fields are check and updated.

b ) The specials_limit_quantity allows you to set how many units of a product can be sold at sale price. An

example would be you have 8 units of a product and you want to sell only 3 at the sale price, you would

set the specials_limit_quantity to 5. Now the database fields would be compared each time and if the limit

is reached before the sale end date the products sale would end and would revert back to it's regular price.

At present this will not stop a customer from buying more than allowed if they go over the limit with the one

purchase they are making as the special file does not update the status until after the completed purchase.

With a future update I will be looking at possibly change the way in which this is handled.

 

2) filtering products by:

a ) manufacturers.

b ) category and subcategory or exclude subcategory with checkbox checked.

c ) products name.

d ) all active products or with include inactive products checkbox checked the inactive products will be included.

e ) same as above except exclude specials checkbox checked

f ) all active/inactive specials with both checboxes checked, or only active or inactive depending on checkbox checked.

 

3) sorting by:

a ) when all products listed:

* product id (default)

* product model

* product name

* product quantity

* product price

b ) when only active/inactive specials listed:

* product id (default)

* product model

* product name

* product quantity

* product price

* product specials end date

* product specials start date

* product specials limit quantity sales

 

4) Allow update of specials by selected criteria above

a ) at the global level

* update specials sales price: (required except using reset dates button)

+ the amount can be in currency or in a percentage, which is chosen by the drop down.

+ this is required to be greater than zero and less the regular price of item or less than 100%.

* update start date field: (not required)

+ if no start date is given than the item will be set to go on sale as soon as it is updated.

+ if start date is entered which must be entered as MM/DD/YYYY that will be the date for the sale to start.

* update end date field: (not required)

+ if no end date is given than the item will remain on sale until you change the status with the status icon or by entering an end date at which point when the end date comes it will end the sale on the item.

+ if end date is entered which must be entered as MM/DD/YYYY that will be the date for the sale to end.

REMEMBER THAT AT THE GLOBAL LEVEL AS PRODUCTS UNDER THE SELECTION CRITERIA WILL BE UPDATED INCLUDED PRODUCTS ON OTHER PAGES IF THERE IS MORE THAN ONE PAGE!!

THOSE PRODUCTS THAT WOULD BE PRICED EQUAL TO OR GREATER THAN REGULAR PRICE WILL NOT BE AFFECTED AS THE PROGRAM ONLY DEALS WITH SPECIAL LOWER PRICES (SALES).

 

b ) at the local (individual) level

* update specials sales price: (required)

+ the amount can be in currency or in a percentage, which is chosen by the drop down.

+ this is required to be greater than zero and less the regular price of item or less than 100%.

* update start date field: (not required)

+ if no start date is given than the item will be set to go on sale as soon as it is updated.

+ if start date is entered which must be entered as MM/DD/YYYY that will be the date for the sale to start.

* update end date field: (not required)

+ if no end date is given than the item will remain on sale until you change the status with the status icon or by entering an end date at which point when the end date comes it will end the sale on the item.

+ if end date is entered which must be entered as MM/DD/YYYY that will be the date for the sale to end.

* update specials limit quantity field: (not required)

+ special limit must be < product limit.

 

5) Error handling:

a ) specials sales price:

* price must be greater than 0 < product regular price, percentage must be greater than 0 < 100%.

b ) start date field:

* must be in correct format and valid date.

c ) end date field:

* must be in correct format and valid date and greater than (if no start date entered than greater present date else greater than start date).

d ) specials limit quantity:

* special limit must be < product limit.

e ) checkboxes:

* Exclude Specials cannot be checked at the same time as Active Specials Only and/or Inactive Specials Only.

 

**********************************************************************************************************************

Edited by KDM

Share this post


Link to post
Share on other sites

Hey nice work - We have added it without any problems at all to our store this evening - and have to say it is very versatile. Ideal :D

 

We use Social Runner and I will work on including the relevant snippets of Social Runner coding to it to make it even more versatile. If you wish to have the adapted code, I will forward on to you once fully tested.

 

Thanks for a great contrib.

Share this post


Link to post
Share on other sites

Hey nice work - We have added it without any problems at all to our store this evening - and have to say it is very versatile. Ideal :D

 

We use Social Runner and I will work on including the relevant snippets of Social Runner coding to it to make it even more versatile. If you wish to have the adapted code, I will forward on to you once fully tested.

 

Thanks for a great contrib.

 

Thanks Rob,

I appreciate the compliment.

You could pm me the snippets of code you are talking about. I'll take a look at it.

Something I meant to suggest if you haven't done it, is:

In Configuration - Maximum Value - Specials Products;

you can set the value to a higher number so that you can view more products in Specials Maintenance. Be careful as this also affects the store side in the amount of specials that will appear. Mine is set to 30 which in my case works for both the administration and store sides.

Share this post


Link to post
Share on other sites

I think this may be what I'm looking for, but have a quick question if someone can answer it for me.

Will the product(s) I put on special price be added to the "Specials" base in the shopping cart?

Do I have to set a specified number of items to put on special or can it be just for a specified time period?

Thanks!

Share this post


Link to post
Share on other sites

Will the product(s) I put on special price be added to the "Specials" base in the shopping cart?

 

The special price that you set will be reflected thought out the shopping cart.

Check out the specials on this site:

Specials Administration (store side)

 

Do I have to set a specified number of items to put on special

 

No, the specials_limit_quantity field will limit only that sale item to the set number to be sold at that specials price.

Keep in mind 2 things when you set a limit quantity to sale.

 

a )The total number of items to sell at sell will be the difference between your total number of that item in stock minus the specials_limit_quantity you set:

EXAMPLE: 8 units of a product and you want to sell only 3 at the sale price, you would set the specials_limit_quantity to 5! 8-5=3

 

b ) At the moment there is no stopping anyone from buying all of a specials item at once even when you have set a specials_limit_quantity. But as in the example above if that individual brought more than 3 but less than 8 than at that point the system would automatically take the product off the specials price. At that point they would only be able to buy the rest of that product at full price.

 

 

or can it be just for a specified time period?

 

You have a start date and an end date that you can set.

If no start date then it goes on sale immediately else it will start at the first second of the start date that you have set.

If no end date then the sale goes until you end it else it will end at the first second of the end date that you have set.

You can always go into "Specials Administration" and enable or disable the sale item at any time.

Share this post


Link to post
Share on other sites

I have just added a new upload with a few fixes;

A ) catalog/admin/specials_maintenance.php

 

1 ) When removing single product from specials file the error message was not complete. Fixed.

 

2 ) On occasions there was a '/' after list. The program ended abruptly. Fixed

 

3 ) Need to pass a return array variable with tep_checkdate. Fixed.

 

Full Package

This should work with Oscommerce version2.3.1. If you install into 2.3.1 and have problems let me know.

I will be testing it soon and will update more on whether it will work with 2.3.1

 

Specials Maintenance - Administration

Share this post


Link to post
Share on other sites

Hi,

 

I have noticed a bug in install instructions in catalog/admin/includes/application_top.php

 

 

 

>>>>2 ) FIND;

 

// initialize the message stack for output messages

require(DIR_WS_CLASSES . 'message_stack.php');

 

>>>>>>>>REPLACE WITH:

 

// override the admin message stack to use the store message stack

if(false !== strpos($PHP_SELF, FILENAME_SPECIALS)) {

require(DIR_FS_CATALOG . DIR_WS_CLASSES . 'boxes.php');

require(DIR_FS_CATALOG . DIR_WS_CLASSES . 'message_stack.php');

} else {

// initialize the message stack for output messages

require(DIR_WS_CLASSES . 'message_stack.php');

}

 

it should be replace with

// override the admin message stack to use the store message stack

if(false !== strpos($PHP_SELF, FILENAME_SPECIALS_MAINTENANCE)) {

require(DIR_FS_CATALOG . DIR_WS_CLASSES . 'boxes.php');

require(DIR_FS_CATALOG . DIR_WS_CLASSES . 'message_stack.php');

} else {

// initialize the message stack for output messages

require(DIR_WS_CLASSES . 'message_stack.php');

}

 

Steve

Share this post


Link to post
Share on other sites

 

I have noticed a bug in install instructions in catalog/admin/includes/application_top.php

 

 

Hi Steve,

 

Thanks for noticing. I actually have it correct in the application_top.php that comes with the down load but will have correct the install instructions.

 

Kerry

Share this post


Link to post
Share on other sites

I uploaded the latest version once again with the correction made to the install instruction that would affect the error handling.

You can download that or just copy the code below and and put in the correct place.

 

In catalog/admin/includes/application_top.php

FIND;

// initialize the message stack for output messages
require(DIR_WS_CLASSES . 'message_stack.php');

 

REPLACE WITH:

// override the admin message stack to use the store message stack
if(false !== strpos($PHP_SELF, FILENAME_SPECIALS_MAINTENANCE)) {
require(DIR_FS_CATALOG . DIR_WS_CLASSES . 'boxes.php');
require(DIR_FS_CATALOG . DIR_WS_CLASSES . 'message_stack.php');
} else {
// initialize the message stack for output messages
require(DIR_WS_CLASSES . 'message_stack.php');
}

 

Thanks to Steve S. for pointing this out.

 

Specials Maintenance - Administration v1.1

Edited by KDM

Share this post


Link to post
Share on other sites

Hello,

 

I use specials maintance for the first time now but when adding a product is says "Special Product Limit quantity 0 must be less than Product quantity 0!!"

I dont use the quantity in OSCommerce but how can i turn off checking for it?

It would be nice to sell a product only say 5 times for special price and then the normal price.

That way i can say "For first 5 costumers jus 75€ instead of 99€" but i can't use the product quantity in oscommerce because not all is in stock and special orderd stuff..

 

Can jou help?

 

Jasper

Share this post


Link to post
Share on other sites

Hello,

 

I use specials maintance for the first time now but when adding a product is says "Special Product Limit quantity 0 must be less than Product quantity 0!!"

I dont use the quantity in OSCommerce but how can i turn off checking for it?

It would be nice to sell a product only say 5 times for special price and then the normal price.

That way i can say "For first 5 costumers jus 75€ instead of 99€" but i can't use the product quantity in oscommerce because not all is in stock and special orderd stuff..

 

Can jou help?

 

Jasper

 

Hi Jasper,

Sorry it took so long to reply. I've had personal business to take care of lately.

 

The problem with turning off the product quantity check is there will be no way to track the number of products sold at the special price.

I suggest you add a quantity into your products_quantity field for those products you want to put on special.

Oscommerce will subtract the quantity from the product if have set the system to subtract the quantity. Go to:

Configuration-Stock-Subtract stock and set it to true.

 

This will allow the Specials Maintenance system to track the sales of products sold at the special price quantity goal. This should not affect your regular sales as it is the "Allow Checkout" configuration that affect sales being allowed.

 

Keep in mind that my system is not set to stop at the exact special quantity during the checkout process. Read the "READ ME" file number 1-b under "What this contribution should accomplish:" to understand how the specials quantity works.

 

I will revisit this situation when I start work on my next update to Specials Maintenance.

Share this post


Link to post
Share on other sites

Great contrib ... but

 

1. My store uses decimal prices so, if I put the special price, let's say 2,67 and the product price is 2,99 I receive the fallowing error:

Sale Price 2 must be less than Product Price 2. The only way to make this work is to put a procentage instead. But if I want to modify something to that special product I receive again the same message. If I don't modify anything then works.

2. I use the date format like: dd/mm/yyyy. This format is set up in admin and catalog site so it works. But even if specials_maintenance.php display this format (dd/mm/yyyy) in Start date and End date column when I enter some values the following error is displayed:

End Date: 07/11/2011 must be greater than Start Date: 31/10/2011!! (I'm sure that the end date is greater than start date :)) )

 

I would like to use this contrib but I cannot :(

Also, the problem with "Special Product Limit quantity 0 must be less than Product quantity 0!!" force an admin who doesn't use stock in his shop to go every time to the product page to update the product stock before he can make it special. This is taking some extra time and in my opinion is not good...

 

Waiting for an update ... the idea is great but still need some work

Share this post


Link to post
Share on other sites

Great contrib ... but

 

1. My store uses decimal prices so, if I put the special price, let's say 2,67 and the product price is 2,99 I receive the fallowing error:

Sale Price 2 must be less than Product Price 2. The only way to make this work is to put a procentage instead. But if I want to modify something to that special product I receive again the same message. If I don't modify anything then works.

 

This is just something I missed.

In admin/specials_maintenance.php around line 27

Replace this line:

 

 $products_price = (isset($_GET['price']) && !empty($_GET['price'])) ? intval($_GET['price']):0;

 

With this:

 

 $products_price = (isset($_GET['price']) && !empty($_GET['price'])) ? floatval($_GET['price']):0;

 

 

 

2. I use the date format like: dd/mm/yyyy. This format is set up in admin and catalog site so it works. But even if specials_maintenance.php display this format (dd/mm/yyyy) in Start date and End date column when I enter some values the following error is displayed:

End Date: 07/11/2011 must be greater than Start Date: 31/10/2011!! (I'm sure that the end date is greater than start date

 

My date format is set up as "mm/dd/yyyy" so I had not tested this against other date formats. For a temporary fix that should work look in:

 

admin/includes/functions/gfc_general.php

Around line 31 replace the function completely.

 

This:


function gfc_format_date($date, $time=false) {

   if($time === false) {
	  if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',$date)) {
		 list($month, $day, $year) = explode('/', $date);
		 $date = strftime("%Y-%m-%d %H:%M:%S", mktime(00, 00, 00, $month, $day, $year));
		}
	 } else {	  
	  if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',substr($date, 0, strrpos($date, '/')+5))) {
		 list($month, $day, $year) = explode('/', substr($date, 0, strrpos($date, '/')+5));
		 list($hours, $minute, $seconds) = explode(':', substr($date, strrpos($date, '/')+5));
		 $date = strftime("%Y-%m-%d %H:%M:%S", mktime($hours, $minute, $seconds, $month, $day, $year));
	  }
   }	

   return $date;
  }

 

 

Replace with these two functions:

 

function gfc_date_format($date) {

   $new_array = false;
   $format_string = explode("/", DOB_FORMAT_STRING);
   $compare_format = array('mm','dd','yyyy');
   $date_array = explode("/", $date);
   foreach($format_string as $kf=>$vf) {
	  foreach($compare_format as $kc=>$vc) {
		 if($vf == $vc) {
			$new_array[$k] = $date_array[$kf];
			break;
		   }
		}
	 }
   return $date = ($new_array) ? implode("/", $new_array) : $date;
  }

function gfc_format_date($date, $time=false) {

   $date = gfc_date_format($date);
   if($time === false) {
	  if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',$date)) {
		 list($month, $day, $year) = explode('/', $date);
		 $date = strftime("%Y-%m-%d %H:%M:%S", mktime(00, 00, 00, $month, $day, $year));
		}
	 } else {	  
	  if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',substr($date, 0, strrpos($date, '/')+5))) {
		 list($month, $day, $year) = explode('/', substr($date, 0, strrpos($date, '/')+5));
		 list($hours, $minute, $seconds) = explode(':', substr($date, strrpos($date, '/')+5));
		 $date = strftime("%Y-%m-%d %H:%M:%S", mktime($hours, $minute, $seconds, $month, $day, $year));
	  }
   }	

   return $date;
  }

 

 

Also, the problem with "Special Product Limit quantity 0 must be less than Product quantity 0!!" force an admin who doesn't use stock in his shop to go every time to the product page to update the product stock before he can make it special. This is taking some extra time and in my opinion is not good...

 

You're the second one with this problem and can be solved by replacing this function:

 

In admin/specials_maintenance.php around line 499 find;

 


 function specials_check_quantity($qty, $specials_qty) {

   if($specials_qty < $qty) return true;

   return false;
 }

 

Replace with this code:

 


 function specials_check_quantity($qty, $specials_qty) {

/*  remove logic for check of quantity
if($specials_qty < $qty) return true;

 return false;
*/
 return true;
}

 

 

Waiting for an update ... the idea is great but still need some work

 

I use this on my website and so far it has worked smoothly for me. Of course other users can have a different set up then me and may run into some problems. Just let me know as I do want this to work for most cases.

I will be revisiting this program some time after the first of the year. In the meantime let me know if you have problems.

Share this post


Link to post
Share on other sites

Very nice contribution! I have only one question. If I set "limit quantity" = 0 then the program will stop sale when article runs out right?

Share this post


Link to post
Share on other sites

Very nice contribution! I have only one question. If I set "limit quantity" = 0 then the program will stop sale when article runs out right?

 

When the limit_quantity field is 0 (which is the default value) then the program does no comparison. Only when there is a value greater than 0 in the limit_quantity field is it used to turn specials off. The end date is the main field that the mod uses to control when a sale ends

Try reading the README text file under:

What this contribution should accomplish: 1 b

Perhaps that will help you to better understand what limit_quantity does.

 

As stated in one of my earlier posts I plan to look at this mod after the first of the year and I appreciate anyone's input or problems as it will help me to improve it for everyone.

Share this post


Link to post
Share on other sites

First, great contribution! It's saved us a ton of time managing what's on special.

 

My one concern is, it throws a MYSQL error when I try to apply a Special price to a group of items that I've arrived at by keyword search of their Product Names.

 

The error I get is:

1054 - Unknown column 'pd.products_name' in 'where clause'
SELECT p.products_id AS pid, s.specials_id AS sid FROM products p LEFT JOIN specials s ON p.products_id=s.products_id WHERE p.products_status=1 AND p.manufacturers_id = '13' AND pd.products_name LIKE '%my search terms%'

 

Looking at the code behind it, I can kind of tell how the MYSQL query is dynamically built based on what flags the user has set, but for some reason it's not picking up the Product Description table when $product_name exists, though it looks like it should. Any hints on how to fix this?

Edited by SpongeMaximus

Share this post


Link to post
Share on other sites

 

This is just something I missed.

In admin/specials_maintenance.php around line 27

Replace this line:

 

 $products_price = (isset($_GET['price']) && !empty($_GET['price'])) ? intval($_GET['price']):0;

 

With this:

 

 $products_price = (isset($_GET['price']) && !empty($_GET['price'])) ? floatval($_GET['price']):0;

 

 

 

 

 

My date format is set up as "mm/dd/yyyy" so I had not tested this against other date formats. For a temporary fix that should work look in:

 

admin/includes/functions/gfc_general.php

Around line 31 replace the function completely.

 

This:


function gfc_format_date($date, $time=false) {

   if($time === false) {
	  if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',$date)) {
		 list($month, $day, $year) = explode('/', $date);
		 $date = strftime("%Y-%m-%d %H:%M:%S", mktime(00, 00, 00, $month, $day, $year));
		}
	 } else {	  
	  if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',substr($date, 0, strrpos($date, '/')+5))) {
		 list($month, $day, $year) = explode('/', substr($date, 0, strrpos($date, '/')+5));
		 list($hours, $minute, $seconds) = explode(':', substr($date, strrpos($date, '/')+5));
		 $date = strftime("%Y-%m-%d %H:%M:%S", mktime($hours, $minute, $seconds, $month, $day, $year));
	  }
   }	

   return $date;
  }

 

 

Replace with these two functions:

 

function gfc_date_format($date) {

   $new_array = false;
   $format_string = explode("/", DOB_FORMAT_STRING);
   $compare_format = array('mm','dd','yyyy');
   $date_array = explode("/", $date);
   foreach($format_string as $kf=>$vf) {
	  foreach($compare_format as $kc=>$vc) {
		 if($vf == $vc) {
			$new_array[$k] = $date_array[$kf];
			break;
		   }
		}
	 }
   return $date = ($new_array) ? implode("/", $new_array) : $date;
  }

function gfc_format_date($date, $time=false) {

   $date = gfc_date_format($date);
   if($time === false) {
	  if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',$date)) {
		 list($month, $day, $year) = explode('/', $date);
		 $date = strftime("%Y-%m-%d %H:%M:%S", mktime(00, 00, 00, $month, $day, $year));
		}
	 } else {	  
	  if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',substr($date, 0, strrpos($date, '/')+5))) {
		 list($month, $day, $year) = explode('/', substr($date, 0, strrpos($date, '/')+5));
		 list($hours, $minute, $seconds) = explode(':', substr($date, strrpos($date, '/')+5));
		 $date = strftime("%Y-%m-%d %H:%M:%S", mktime($hours, $minute, $seconds, $month, $day, $year));
	  }
   }	

   return $date;
  }

 

 

 

 

You're the second one with this problem and can be solved by replacing this function:

 

In admin/specials_maintenance.php around line 499 find;

 


 function specials_check_quantity($qty, $specials_qty) {

   if($specials_qty < $qty) return true;

   return false;
 }

 

Replace with this code:

 


 function specials_check_quantity($qty, $specials_qty) {

/*  remove logic for check of quantity
if($specials_qty < $qty) return true;

 return false;
*/
 return true;
}

 

 

 

 

I use this on my website and so far it has worked smoothly for me. Of course other users can have a different set up then me and may run into some problems. Just let me know as I do want this to work for most cases.

I will be revisiting this program some time after the first of the year. In the meantime let me know if you have problems.

 

 

Hi,

 

Thank you for your work, this can be a great contribution.

I tried these instructions. However, I still get errors.

1. Let's say, my price w/tax is 68.50 and I want to make my sale price w/tax 60.00. I get the error: Sale Price 60 must be less than Product Price 56.6116.

2. In the date sections, I see this: dd/mm/jjjj, this is dutch (not dd/mm/yyyy and not mm/dd/yyyy). If I fill out a date, say 31/12/2011, even after above changes, I get the error: Invalid End Date: 31/12/2011!!

 

Thank you in advance!

Share this post


Link to post
Share on other sites

Hi! This is my busy time of the year as I have been packing and shipping products for the Christmas Season.

I've taken a quick look at your problems and this is what I see.

 

1. Let's say, my price w/tax is 68.50 and I want to make my sale price w/tax 60.00. I get the error: Sale Price 60 must be less than Product Price 56.6116.

 

The program at this point will test only the sale price against products price, not against the product price plus tax. I will have to look at this more in depth for the changes to be made to take into account the taxes. Not everyone includes their discount with taxes, the taxes are usually added on to the cost. At least that is how it is usually done in the US.

 

2. In the date sections, I see this: dd/mm/jjjj, this is dutch (not dd/mm/yyyy and not mm/dd/yyyy). If I fill out a date, say 31/12/2011, even after above changes, I get the error: Invalid End Date: 31/12/2011!!

 

The changes I made were for a quick fix in certain situations. Again I will have to look at this more in depth to handle more possibilities for the date format.

You can try this and see if changing some code will work for you.

In the function gfc_date_format look for $compare_format = array('mm', 'dd', 'yyyy');

 

   function gfc_date_format($date) {

	   $new_array = false;
	   $format_string = explode("/", DOB_FORMAT_STRING);
	   $compare_format = array('mm','dd','yyyy');
	   $date_array = explode("/", $date);
	   foreach($format_string as $kf=>$vf) {
			  foreach($compare_format as $kc=>$vc) {
					 if($vf == $vc) {
							$new_array[$k] = $date_array[$kf];
							break;
					   }
					}
			 }
	   return $date = ($new_array) ? implode("/", $new_array) : $date;
	  }

 

Change the 'yyyy' to the value that you need 'jjjj'

See if this works.

 

As I look at these things and come up with a solution I will let you know.

You can let me know if the above works for you.

Thanks

Share this post


Link to post
Share on other sites

Thank you for your response.

 

1. Ok thanks, hopefully you can fdind anything to change this to prices incl tax. I t would be a lot easier and that woul mean a lot to me.

2. I tried several different options, including $list and strftime options (also jjjj, yyyy, dd mm yyyy or dd mm jjjj), but still I am getting the message: error.gif Invalid End Date: 01/01/2012!!

I just cant figure out why this is. Below my last version:

 

function gfc_date_format($date) {

$new_array = false;

$format_string = explode("/", DOB_FORMAT_STRING);

$compare_format = array('dd','mm','jjjj');

$date_array = explode("/", $date);

foreach($format_string as $kf=>$vf) {

foreach($compare_format as $kc=>$vc) {

if($vf == $vc) {

$new_array[$k] = $date_array[$kf];

break;

}

}

}

return $date = ($new_array) ? implode("/", $new_array) : $date;

}

 

function gfc_format_date($date, $time=false) {

$date = gfc_date_format($date);

if($time === false) {

if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',$date)) {

list($day, $month, $year) = explode('/', $date);

$date = strftime("%d-%m-%Y %H:%M:%S", mktime(00, 00, 00, $day, $month, $year));

}

} else {

if(preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4,4})$/',substr($date, 0, strrpos($date, '/')+5))) {

list($day, $month, $year) = explode('/', substr($date, 0, strrpos($date, '/')+5));

list($hours, $minute, $seconds) = explode(':', substr($date, strrpos($date, '/')+5));

$date = strftime("%d-%m-%Y %H:%M:%S", mktime($hours, $minute, $seconds, $day, $month, $year));

}

}

return $date;

}

 

function gfc_current_date($time=false) {

 

$timestamp = getdate();

if($time === false) {

$date = gfc_format_date($timestamp['mday'].'/'.$timestamp['mon'].'/'.$timestamp['year'], $time);

} else {

$date = gfc_format_date($timestamp['mday'].'/'.$timestamp['mon'].'/'.$timestamp['year'].' '. $timestamp['hours'].':'.$timestamp['minutes'].':'.$timestamp['seconds'], $time);

}

 

return $date;

}

 

 

Thank you and have a great New Year's eve!

 

Michiel

Share this post


Link to post
Share on other sites

Hi,

 

I hope someone can help me out with this problem, that I already pointed out in an earlier post.

 

I still get these errors, when I enter a product on special. The errors than bother me most are the date errors. The last error is because the special price must be entered without tax.

error.gif Invalid Start Date: 04/04/2012!! error.gif Invalid End Date: 05/05/2012!! error.gif Sale Price 5.65 must be less than Product Price 5.

 

I cán enter a special, without filling out the start and end dates, but I need dates to work.

 

Thank you!

Share this post


Link to post
Share on other sites

Hi,

 

I hope someone can help me out with this problem, that I already pointed out in an earlier post.

 

Thank you!

 

Check your personal message. I sent you one today concerning these problems.

Share this post


Link to post
Share on other sites

2. I use the date format like: dd/mm/yyyy. This format is set up in admin and catalog site so it works. But even if specials_maintenance.php display this format (dd/mm/yyyy) in Start date and End date column when I enter some values the following error is displayed:

End Date: 07/11/2011 must be greater than Start Date: 31/10/2011!! (I'm sure that the end date is greater than start date smile.png) )

I have the same error. Is there the fix already? I tried to replace the function gfc_format_date as suggested but without success. Moreover, there is no errors if I enter start date as dd/mm/yyyy and end date as mm/dd/yyyy, but the end date becames incorrect. For example i I enter 03/31/2012, it becomes 07/03/2014.

This makes the use of this contribution impossible. Any clues?

Edited by Leo2

Share this post


Link to post
Share on other sites

Hi. I installed this add-on on osc v2.3.2. When I click on Deactivate All button or try to set a status of any individual product to inactive, it redirects me to a forbidden page. Any ideas?

 

Also, I'd like to change the buttons in admin/specials_maintenance.php for osc v2.3.2. How do I do that?

 

Thanks.

Edited by Irin

Share this post


Link to post
Share on other sites

Hi

It is great contribution. Thank you so much.

I have small problem in it. IDK anyone face this but i would like to share. I have implemented this add ons in my local site and whenver i try to filter any product in it, it is redirecting to loing page. Same thing is occurring when i press Active/Inactive, Refresh and Delete button. 

 

Please guide me. I appreciate your time for this.

 

Thanks

 

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

×