Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Cntribution] Specials Automation


Recommended Posts

I had just noticed a minor error when adding a new product, that it does not save your Products Specials. This is due to the Specials table needs a product ID before it can insert the special, and therefore have come up with this quick fix:

 

In categories.php, replace the code I had illustrated you insert in the install.txt file with the code below:

 

<?php if (isset($HTTP_GET_VARS['pID'])){?>

<tr bgcolor="#ebebff">

<td colspan="2" class="main"><b>Products Special</b><br>

<span class="smalltext">This is for automating the Specials Fucntions in the core. If you care to have have a product listed as a special, fillout the fields below. Otherwise skip this portion of the form.</span></td>

</tr>

<tr bgcolor="#ebebff">

<td colspan="2"><?php

$product_special_query = tep_db_query("select specials_new_products_price, expires_date, valid_from_date from " . TABLE_SPECIALS . " where products_id='". $HTTP_GET_VARS['pID'] ."'");

$product_specials = tep_db_fetch_array($product_special_query);

 

//$sInfo = new objectInfo($product);

?>

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo 'Product Special Price:'; ?> </td>

<td class="main"><?php echo tep_draw_input_field('specials_price', (isset($product_specials['specials_new_products_price']) ? $product_specials['specials_new_products_price'] : '')); ?></td>

</tr>

<tr>

<td class="main"><?php echo 'Product Special Starts on:'; ?> </td>

<td class="main"><?php echo tep_draw_input_field('vday', (isset($product_specials['valid_from_date']) ? substr($product_specials['valid_from_date'], 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('vmonth', (isset($product_specials['valid_from_date']) ? substr($product_specials['valid_from_date'], 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('vyear', (isset($product_specials['valid_from_date']) ? substr($product_specials['valid_from_date'], 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onMouseOver="calSwapImg('BTN_valid_date', 'img_Date_OVER',true);" onMouseOut="calSwapImg('BTN_valid_date', 'img_Date_UP',true);" onClick="calSwapImg('BTN_valid_date', 'img_Date_DOWN');showCalendar('new_special','vday', 'vmonth', 'vyear','dte_valid_When','BTN_valid_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_valid_date"'); ?></a>

</tr>

<tr>

<td class="main"><?php echo 'Product Special expires on:'; ?> </td>

<td class="main"><?php echo tep_draw_input_field('day', (isset($product_specials['expires_date']) ? substr($product_specials['expires_date'], 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($product_specials['expires_date']) ? substr($product_specials['expires_date'], 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($product_specials['expires_date']) ? substr($product_specials['expires_date'], 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onMouseOver="calSwapImg('BTN_date', 'img_Date_OVER',true);" onMouseOut="calSwapImg('BTN_date', 'img_Date_UP',true);" onClick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special', 'day', 'month','year', 'dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a></td>

</tr>

</table>

</td></tr><?php }else{?>

<tr bgcolor="#ebebff">

<td colspan="2" class="main"><b>Products Special</b><br>

<span class="smalltext">Products Special will become availabe as soon as the product has been successfully added.</span></td>

</tr>

<?php }?>

 

This is just a quick fix, and will look into developing a better fix in a future release.

Edited by demonangel
Link to comment
Share on other sites

PLease Disregard the previous post, as the updated (and complete version has been uploaded to the contributions section.

 

http://www.oscommerce.com/community/contributions,4325

 

PLEASE USE THE V.2.0 DOWNLOAD

Hi there...

Great idea - I was just wondering if you made any changes to Felix Shcwarts' "Specials Valid From" contrib, because I recently tried to install it and had a heap of probs... Willing to give it another go if you thik it's working ok, I just couldn't get any response from the forums about whether or not someone had it working on their site.

 

~bobsi18~

Link to comment
Share on other sites

I had directly installed Felix's "Specials Valid From" Contribution without error or incident.

 

What kind of problems are you having?

 

Becasue I ran his SQL query in the install.txt file and uploaded the files as they were and had no issues.

Link to comment
Share on other sites

I had directly installed Felix's "Specials Valid From" Contribution without error or incident.

 

What kind of problems are you having?

 

Becasue I ran his SQL query in the install.txt file and uploaded the files as they were and had no issues.

The main problem I had was when a special is modified, it doesn't save the modification and it enters a new special into the database with products_id = 0. This means that everything in my store changes it's price to this new special's... I wrote about it here (other people were having problems too)-->http://www.oscommerce.com/forums/index.php?sho...45entry865545

 

~bobsi18~

Link to comment
Share on other sites

  • 2 months later...

I ran the SQL line in the install text file to add the valid from date to MySQL...

I copied over the required files and made the required changes to categories.php.

 

If I add specials in through the specials window the normal way, it puts them on special straight away and ignores the start date...

 

If I add specials through the inline editor when adding products it does nothing at all! Any assistance would be appreciated. This would be a really valuable contribution for my store as a lot of times the product is not coming on special for several weeks...

 

Cheers,

 

Andrew

www.smartgoods.com.au

Link to comment
Share on other sites

  • 1 year later...

Hello,

 

a) what's the difference between the 'specials_automation' and the 'specials_automation2' directory?

 

B) I've installed the files from 'specials_automation', and get the following error message in the admin panel:

 

1146 - Table 'shop.Specials' doesn't exist

 

Select specials_new_products_price, valid_from_date, expires_date from Specials where specials_id='3483'

 

How can I fix it?

 

thanks,

r.

Link to comment
Share on other sites

Hello,

 

a.) what's the difference between the 'specials_automation' and the 'specials_automation2' directory?

 

b.) I've installed the files from 'specials_automation', and get the following error message in the admin panel:

 

1146 - Table 'shop.Specials' doesn't exist

 

Select specials_new_products_price, valid_from_date, expires_date from Specials where specials_id='3483'

 

In fact, the table exists in my database, and I've followed all instructions in the zip file (when I had the 'specials_automation2' installed, I got no error message).

How can I fix it?

 

thanks,

r.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...