If this is your first visit, check our documentation. To post, register or login.
Forums / Setting Up Categories, Products, Attributes / v1.5.7d Adding Products from vendor API

v1.5.7d Adding Products from vendor API

Started by bbsbcastle on 19 Nov 2022, 10:45 AM · Views: 8,030

Results 1 to 3 of 3
19 Nov 2022, 10:45 AM
#1
bbsbcastle avatar

bbsbcastle

New Zenner

Join Date:
Aug 2009
Location:
Greeneville, TN USA
Posts:
55
Plugin Contributions:
0

v1.5.7d Adding Products from vendor API

Working on a new site. As part of that I've made a new admin menu item that allows the user to enter a vendor SKU or a manufacturer's part number and use a vendor API to find a product skeleton.

I have all that part working and have all the product info sitting in $_POST fields ready to be processed on the "Is this the one?" confirmation screen.

What I would really like to do with this is pass the $_POST over to collect_info.php and allow it to handle the editing and actual product insertion. I think I see how to bypass collect_info and go to preview_info, but I'd rather not do it that way.

Can I do this or will I have to settle for preview_info?

23 Nov 2022, 10:14 AM
#2
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Re: v1.5.7d Adding Products from vendor API

I think you should review how collect_info handles the data to pre-populate the fields when you use the Back button on the preview_info page.
Then duplicate that action with your custom insert button to load the same fields in collect_info, to be able to review it before inserting it.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

27 Nov 2022, 12:35 AM
#3
bbsbcastle avatar

bbsbcastle

New Zenner

Join Date:
Aug 2009
Location:
Greeneville, TN USA
Posts:
55
Plugin Contributions:
0

Re: v1.5.7d Adding Products from vendor API

Thanks torvista.

I ended up looking at how preview_product handled the "Back" button, and the URL I ended up on when calling collect_php in various circumstances.

This form header was the answer I was looking for..

	<?php echo zen_draw_form('product', FILENAME_PRODUCT, 'cPath=' . $cPath . '&action=new_product', 'post', 'enctype="multipart/form-data" class="form-horizontal"'); ?>

After getting the visible and hidden values I want to appear on collect_info into $_POST of course.