Jump to content
BrockleyJohn

Quick Product Updates for osc 2.3+

Recommended Posts

3 hours ago, BrockleyJohn said:

ok, you can do this in the addon by cheating a little. Start by changing the page to show the maximum number of lines in the drop-down (100). You'll see this adds a parameter to the end of the url: row_by_page=100

Just edit this to a bigger number than the number of products you have, eg row_by_page=10000

BUT the code is not written very efficiently and you may find that it times out trying to update too many products.

 

 

Gives a 413 page error too much data..

2 hours ago, JcMagpie said:

A simple solution may be to simply use phpMyAdmin to run a simple SQL query somthng like,

UPDATE products SET `products_price`=`products_price`+100 (100 can be replaced by any number you like)

Test by first simulating on your db and backup first.

image.thumb.png.443cab97cf9e683391e79d59f6d18e85.png

Need to do it by 5%

 

 

Please Help!!!

Share this post


Link to post
Share on other sites

You already have that info. price = price*1.05 is 5%

update `products` set `products_price` = (`products_price` * '1.05') WHERE `manufacturers_id` = '1'; 

 

image.png.7ccad277b0b61ca636f0ad837eb124fd.png

Edited by JcMagpie

 

Share this post


Link to post
Share on other sites

if the image does not appear in the top right corner change line 538  and 543 "  .  '/images' . to "   .  'images/'  . " in quick_updates.php.

Edited by dreumel

Share this post


Link to post
Share on other sites
10 hours ago, dreumel said:

if the image does not appear in the top right corner change line 538  and 543 "  .  '/images' . to "   .  'images/'  . " in quick_updates.php.

Wish I'd seen that before building the next release! Incorporated for a future version - there are two places to change; one for the category image and one for the manufacturer image.


Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

version 3.1.1 is available for download from https://apps.oscommerce.com/Apps&XpKWd&quick-update-bs

Sponsored by @supercheaphobb it includes options for working with prices including tax and adding a datepicker to the specials expiry date. It also fixes the manufacturer query error that @radhavallabh hit the other day but not the latest bug above.

Update is simple - just copy the files. New options are added automatically when you access the page and set to default.


Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

Hi John,
Is there a way to implement a search function? Like the one in the admin/categories tab? Great add-on!

Share this post


Link to post
Share on other sites

hi there,

My client has asked if the off/on buttons can be colorized to be red/green for easier scanning.

Has anyone else done this for this module, in which case can you please share? 

Share this post


Link to post
Share on other sites

@drusky Donna, radio buttons are rendered by the browser directly using built-in images so they can't be styled directly. The technique of images inside links used on the admin/categories page for status wouldn't be any good here because it requires reloading the page to change the button.

On the other hand, it is possible to do something with pseudo elements - basically hide the radio buttons themselves and show something that can be styled instead. The technique is described in this answer on stackoverflow: https://stackoverflow.com/a/38468320/4384632

 


Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

I have just uploaded v3.1.2 to the addons area - https://apps.oscommerce.com/XpKWd&quick-update-bs

This version, sponsored by @drusky, introduces coloured radio buttons for product and special status:

It also includes the image fix by @dreumel and a bunch of fixes for php7.2 compatibility.

Tested against CE Phoenix v1.0.1.2

Screenshot-v3.1.2.jpg


Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

@artfulweb this isn't particularly a phoenix problem, it's historically crap code. If you put at the top of file - before or after including application_top

$current_category_id = 0;

it should behave in exactly the same way as now but without the notices. Confession - I have not tested this!


Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites
11 minutes ago, BrockleyJohn said:

@artfulweb this isn't particularly a phoenix problem, it's historically crap code. If you put at the top of file - before or after including application_top


$current_category_id = 0;

it should behave in exactly the same way as now but without the notices. Confession - I have not tested this!

Perfect! Thanks John.

Share this post


Link to post
Share on other sites

Hi I am just trying to get this to work with Phoenix 1076 and am getting this error - any thoughts what it may be?

 

Regards!

Warning: Use of undefined constant TABLE_TAX_CLASS - assumed 'TABLE_TAX_CLASS' (this will throw an Error in a future version of PHP) in D:\XAMP\htdocs\phoenix1076\admin\quick_updates.php on line 258
1146 - Table 'phoenix1076.table_tax_class' doesn't exist

select tax_class_id, tax_class_title from TABLE_TAX_CLASS order by tax_class_title

Share this post


Link to post
Share on other sites
1 hour ago, nedragdnuos said:

Warning: Use of undefined constant TABLE_TAX_CLASS

In general, when you see errors of this form TABLE_SOMETHING in regards to SQL, the fix is to go through and replace

" . TABLE_TAX_CLASS . "

with

tax_class

And yes, it is deliberate to remove the quotation marks and periods when doing that.  Before the code was concatenating the constant into the string.  Now the constant is gone and you just put the table name directly into the string. 

"select tax_class_id, tax_class_title from tax_class order by tax_class_title"

Note that this means that the App was last updated prior to the 1.0.5.9 release.  So we're two .0 versions past the change being made that broke this.  And we're even further past the start of the change, which actually predates Phoenix.  I mention this because unless you have budget to get this updated professionally, you might find that there are other issues that are not current in the code.  This just being a particularly visible instance. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
2 hours ago, nedragdnuos said:

Hi I am just trying to get this to work with Phoenix 1076 and am getting this error - any thoughts what it may be?

 

Regards!

Warning: Use of undefined constant TABLE_TAX_CLASS - assumed 'TABLE_TAX_CLASS' (this will throw an Error in a future version of PHP) in D:\XAMP\htdocs\phoenix1076\admin\quick_updates.php on line 258
1146 - Table 'phoenix1076.table_tax_class' doesn't exist

select tax_class_id, tax_class_title from TABLE_TAX_CLASS order by tax_class_title

Here is a quick and dirty (and untested) update which side-steps the issue. There are some extra 'defines' at the top of the file, which you can change if I have missed any or made any tyops in the table names.

Some of the code in this addon will be putting its teenage years behind it soon. It was updated to work with early Phoenix which still had the classic 2.3 admin but it has none of the latest Phoenix changes. It definitely won't be responsive and may throw some wobblies. I think there are people running it on 1.0.5.n

quick_updates.php


Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

Hi guys thanks for the help, its thrown up a few more errors so may have to drop this addon for the time being as I am not a coder (although given covid19 gives me plenty of time kind of), its not essential, just really handy, just wondering why something like this would not be in the core?

Anyways thanks for the help.

 

Share this post


Link to post
Share on other sites
7 hours ago, nedragdnuos said:

Hi guys thanks for the help, its thrown up a few more errors so may have to drop this addon for the time being as I am not a coder (although given covid19 gives me plenty of time kind of), its not essential, just really handy, just wondering why something like this would not be in the core?

Anyways thanks for the help.

 

What further errors did it throw up?


Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

Hi John, I cleaned up the top section you added, products description was still tax_class and after that change it worked and this is what I am getting, an error on the right a broken image that says "switch to complete edit"

require('includes/application_top.php');

$current_category_id = 0;

if (! defined('TABLE_TAX_CLASS')) define('TABLE_TAX_CLASS', 'tax_class');
if (! defined('TABLE_MANUFACTURERS')) define('TABLE_MANUFACTURERS', 'manufacturers');
if (! defined('TABLE_CATEGORIES')) define('TABLE_CATEGORIES', 'categories');
if (! defined('TABLE_PRODUCTS')) define('TABLE_PRODUCTS', 'products');
if (! defined('TABLE_PRODUCTS_DESCRIPTION')) define('TABLE_PRODUCTS_DESCRIPTION', 'products_description'); - had to change this
if (! defined('TABLE_SPECIALS')) define('TABLE_SPECIALS', 'specials');

I hope this helps

Capture.PNG

Share this post


Link to post
Share on other sites
1 hour ago, nedragdnuos said:

Hi John, I cleaned up the top section you added, products description was still tax_class and after that change it worked and this is what I am getting, an error on the right a broken image that says "switch to complete edit"

require('includes/application_top.php');

$current_category_id = 0;

if (! defined('TABLE_TAX_CLASS')) define('TABLE_TAX_CLASS', 'tax_class');
if (! defined('TABLE_MANUFACTURERS')) define('TABLE_MANUFACTURERS', 'manufacturers');
if (! defined('TABLE_CATEGORIES')) define('TABLE_CATEGORIES', 'categories');
if (! defined('TABLE_PRODUCTS')) define('TABLE_PRODUCTS', 'products');
if (! defined('TABLE_PRODUCTS_DESCRIPTION')) define('TABLE_PRODUCTS_DESCRIPTION', 'products_description'); - had to change this
if (! defined('TABLE_SPECIALS')) define('TABLE_SPECIALS', 'specials');

I hope this helps

Capture.PNG

you can make that text go away by copying the attached image to admin/images/ (used to be core osc)

icon_arrow_right.gif


Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

Hi John, thank you for that, it fixed the missing image but when I go to update quantity etc I get this error:

 

Fatal error: Uncaught Error: Call to undefined function tep_set_product_status() in D:\XAMP\htdocs\phoenix1076\admin\quick_updates.php:395 Stack trace: #0 {main} thrown in D:\XAMP\htdocs\phoenix1076\admin\quick_updates.php on line 395

Share this post


Link to post
Share on other sites

@BrockleyJohn John I was looking through the code in the quick_updates file to get a little familiar with it, in preparation for a few changes I wanted to make and noticed that the table defines weren't updated so I went ahead and did that.   In case it is of some help the file is attached.

Dan

quick_updates.zip

 

Edited by Dan Cole

Share this post


Link to post
Share on other sites
On 2/25/2020 at 10:41 PM, BrockleyJohn said:

@artfulweb this isn't particularly a phoenix problem, it's historically crap code. If you put at the top of file - before or after including application_top


$current_category_id = 0;

it should behave in exactly the same way as now but without the notices. Confession - I have not tested this!

I was playing with this quick_update, and found the above line ($current_category_id = 0) did not yield the desired filter result. Apparently the cPath was not calculated correctly due to Phoenix new code

I add these lines (in bold) instead at around line no. 247, and it now works:
 

Quote

 

  // page select fix v2.8.2 June 27, 2009
$row_by_page = (isset($_GET['row_by_page']) ? (int)$_GET['row_by_page'] : MAX_DISPLAY_SEARCH_RESULTS);
define('MAX_DISPLAY_ROW_BY_PAGE' , $row_by_page );

  // calculate category path
  if (empty($_GET['cPath'])) {
    $current_category_id = 0;
    $cPath = '';
  } else {
    $cPath_array = tep_parse_category_path($_GET['cPath']);
    $cPath = implode('_', $cPath_array);
    $current_category_id = end($cPath_array);
  }

$manufacturer = (isset($_GET['manufacturer']) ? (int)$_GET['manufacturer'] : false);
$sort_by = (isset($_GET['sort_by']) ? $_GET['sort_by'] : false);
$page = (isset($_GET['page']) ? $_GET['page'] : false);
//end page select fix v2.8.2

 

 

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

×