sharingsunshine
asked on
Need Help In PHP OOP for a Rest AP?I
Looking for a php programmer familiar with “object oriented programming” using php. I have a rest api with my manufacturer I need to connect with.
In addition, I am using a Wordpress program to export the values. This is the program - https://docs.algolplus.com/order-export-docs/ I need to use this so I can place the orders through my ecommerce backend.
I am getting this error with the code I have written.
In addition, I am using a Wordpress program to export the values. This is the program - https://docs.algolplus.com/order-export-docs/ I need to use this so I can place the orders through my ecommerce backend.
I am getting this error with the code I have written.
<h2>Don't Panic</h2><p>The code you are trying to save produced a fatal error on line 27:</p><strong>Uncaught Error: Call to a member function get_shipping_first_name() on null in /www/theherbsplace_749/public/wp-content/plugins/woocommerce-order-export/classes/core/class-wc-order-export-engine.php(337) : eval()'d code:27
Stack trace:
#0 /www/theherbsplace_749/public/wp-content/plugins/woocommerce-order-export/classes/core/class-wc-order-export-engine.php(337): eval()
#1 /www/theherbsplace_749/public/wp-content/plugins/woocommerce-order-export/classes/core/class-wc-order-export-engine.php(397): WC_Order_Export_Engine::validate_defaults(Array)
#2 /www/theherbsplace_749/public/wp-content/plugins/woocommerce-order-export/classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php(22): WC_Order_Export_Engine::build_file(Array, 'estimate_previe...', 'file', 0, 0, 'test')
#3 /www/theherbsplace_749/public/wp-content/plugins/woocommerce-order-export/classes/class-wc-order-export-admin.php(444): WC_Order_Export_Admin_Tab_Abstract->ajax_preview()
#4 /www/theherbsplace_749/public/wp-includes/class-</strong>
Here is my code$order = new WC_Order(WC_Order_Export_Engine::$order_id);
$LineItem = array();
foreach ( $order->get_items('line_item') as $item_id=>$item) {
$product = $order->get_product_from_item($item);
$lineitem = new stdClass;
$lineitem->itemid = $product->sku;
$lineitem->quantity = $item['qty'];
$lineItems[] = $lineitem;
}
$PaymentDTO = new stdClass;
$PaymentDTO->lastFourDigitsOfCreditCardNumber = ####;
$PaymentDTO->cvv = ###;
$OrderDTO = new stdClass;
$OrderDTO-> accountNumber = ####;
$OrderDTO->shippingAddress = $Address;
$OrderDTO->shippingMethod = $shippingMethod;
$OrderDTO->lineItems = $lineItems;
$OrderDTO->payment = $PaymentDTO;
$Address = new stdClass;
ERROR LINE ***********************$Address->name = $shipping->get_shipping_first_name().' '.$Shipping->get_shipping_last_name();
$Address->line1 = htmlspecialchars(str_replace("\n", " ", trim($order->get_shipping_address_1() )));
$Address->line2 = htmlspecialchars(str_replace("\n", " ", trim($order->get_shipping_address_2() )));
$Address->city = $order->get_shipping_city();
$Address->subdivision = $order->get_shipping_state();
$Address->postalCode = $order->get_shipping_postcode();
$Address->showPricesOnInvoice = 0;
$Address->isSignatureRequired = 0;
$Address->allowSurerPost = 1;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.