Page 1 of 1

[MOD] - Duplicator Button

Posted: Tue Dec 02, 2008 5:35 am
by Qphoria

Code: Select all

What Does This Contrib Do?
This contrib adds the ability to duplicate items with a single button click. See the supported sections area for supported items

Supported Sections:
	•	Products 
		o	Options
		o	Discounts
		o	Categories
		o	Languages
		o	Images
		o	Downloads
	•	Categories
		o	Images
		o	Languages (if category_description contrib is installed)

Features:
	•	New duplicate button on the list page
	•	Javascript confirmation for duplicate
	•	Language file support for button alt text and optional use of automatic number suffix
		(i.e Product 1 -> Product 1(1), Product 1(2), etc)
	•	Added column_id to the list page to easily see the id

Demo(login: demo/demo)
Download

Re: [MOD] - Duplicator Button

Posted: Tue Dec 09, 2008 4:34 am
by djbrock
Fatal error: Call to undefined method Request::gethtml() in /home/xxxxxxx/public_html/xxxxxxxxxx/ocstore/admin/controller/product.php on line 176

is the error I get when I try to duplicate something. This occurs after clicking the OK button.  I've uploaded the Dec. 7 version but it didn't change anything. 

Also, is there SQL? It isn't included in the downloads.

Re: [MOD] - Duplicator Button

Posted: Tue Dec 09, 2008 4:50 am
by Qphoria
Are you using the latest 0.7.9 version of OpenCart (as the readme states  ;)) ?

There is no sql. Just drop in and its ready

Re: [MOD] - Duplicator Button

Posted: Tue Dec 09, 2008 5:04 am
by djbrock
Yes. I upgraded from .7.8 a few days ago.

The same error occurs now, also, when I try to edit the item's info.

Re: [MOD] - Duplicator Button

Posted: Tue Dec 09, 2008 5:33 am
by Qphoria
check your library/environment/request.php file and search for the function:

function gethtml($key, $type = 'GET', $default = NULL) {

Does that exist?

Re: [MOD] - Duplicator Button

Posted: Tue Dec 09, 2008 5:47 am
by djbrock
It is not in there.

Re: [MOD] - Duplicator Button

Posted: Tue Dec 09, 2008 5:53 am
by Qphoria
Then you did not upgrade from 0.7.8 to 0.7.9 properly. That needs to occur first. Please read the readme for the install. You need to upload all the new files, not just run the upgrade script



I went ahead and tried upgrading from 078 to 079 and then installing the mod and it is working fine.

Re: [MOD] - Duplicator Button

Posted: Tue Dec 09, 2008 5:58 am
by djbrock
When I copied the PHP file from the download it worked just fine. You're right, something didn't work just right in the upgrade process.

Re: [MOD] - Duplicator Button

Posted: Wed Dec 10, 2008 5:19 am
by jty
Qphoria wrote: There is no sql. Just drop in and its ready
You left the SQL bit in the readme.rtf
Cut 'n Paste strikes again  ;)

I have it working on 0.7.9RC3 by doing a global replace of gethtml to just get

Question: Is there an easy way to make it jump into edit mode after the clone is created instead of back to the product list page ?
Or am I asking for too much agaaaain  :P

It works beautifully. I nominate this one for 0.8
Thank-you  :-*

Re: [MOD] - Duplicator Button

Posted: Wed Dec 10, 2008 5:34 am
by Qphoria
yea i saw the sql thing.. its fixed in my copy :)

gethtml to just html?? you mean just "get"

Yea i was wondering if edit mode would be best too.

Simple fix.
edit admin/controller/product.php around line 234:

CHANGE:

Code: Select all

$response->redirect($url->ssl('product'));
TO:

Code: Select all

$response->redirect($url->ssl('product', 'update', array('product_id' => $insert_id)));

Re: [MOD] - Duplicator Button

Posted: Wed Dec 10, 2008 6:09 am
by jty
Qphoria wrote: gethtml to just html?? you mean just "get"
LOL. You know what I mean. I haven't slept for a few months. Burning the midnight candle learning php and breaking Open Cart.
I'd better fix my post above in case someone trusts me  8)

Thanks for the edit mode
I've done about 20 products in a live environment and this contribution is a great little gem