Post by tylerpatrick » Sat Jan 12, 2019 12:05 pm

Hello, I am new to OpenCart. I have an API that takes in a file and some data from a form and creates a price for printing services. I have developed the form that submits the data to the API and the API returns an array that has the pricing information based on a file uploaded. How can I have OpenCart use the price generated for the product.

Cheers!

Newbie

Posts

Joined
Tue Nov 06, 2018 6:15 am

Post by kestas » Sat Jan 12, 2019 5:29 pm

more info is needed.. I don't know your API
But If you use some additional api, when you receive prices update just record it's to DB product table something like this...

Code: Select all

$products = array(//array of your products data received from API);
foreach( $products as $product) {
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET `price` = '" . (float)$product['price'] . "', `date_modified` = NOW() WHERE `product_id` = '" . (int)$product['product_id'] . "'");
}

//Of course if your received products array contains this data like "product_id" and "price"

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am
Who is online

Users browsing this forum: No registered users and 264 guests