Show Posts


Topics - vitalmyth

Pages: [1]
1
General Extensions / Working on custom extension
« on: September 11, 2013, 08:42:07 PM »
First, thank you to the AbanteCart team, because I love this cart and I think it is very well made. I am trying to build a very simple custom extension for my business. I am new to web development, but I have done this same extension project for other, simpler carts, and I am trying to figure out how to do the same thing for AbanteCart.

I have several questions, but I will ask them one at a time. First let me introduce the project.

The idea is very simple:
- When customer confirms an order, extension will send order data to a third-party API. Nothing is visible on storefront, but data is sent at checkout/success
- API will return 2 responses. Now I need to store the responses somewhere with order_id, so that I can select them by order_id later. For example, in a new table called "vitalmyth_notes", which has 3 columns: order_id (same as orders table), vitalmyth_response_1, vitalmyth_response_2.
- On admin backend, the page at sales/orders/order #X now shows 2 new things in "Order Summary" section. These new things are vitalmyth_response_1 and vitalmyth_response_2.
- vitalmyth_response_2 will change after first creation. When the order is first confirmed, it will be "Wait," and then after 1-5 days, "Done." So on admin/orders/order #X, I need something like this (very simplified):

$current_response_2 = select vitalmyth_response_2 from table vitalmyth_notes where order_id = id_of_order_X;
if ($current_response_2 == 'Wait') {
$postfields = select * from table_orders where order_id = id_of_order_X;
$response = curl_exec($postfields);
$this->db->execute(update table vitalmyth_notes set vitalmyth_response_2=$response where order_id = id_of_order_X);
echo $vitalmyth_response_2;
} else { echo $vitalmyth_response_2; }

I hope that makes sense although it is not actual code.

My first question is...my extension will be dependent upon ANY credit card gateway, not just 1 in particular. So if ANY credit card gateway is installed, my extension will work, but will not work for other types of orders (cod, bank transfer, etc). Can I set dependencies so that at least 1 credit card gateway is required, but it can be any gateway?

Pages: [1]

Powered by SMFPacks Social Login Mod