ver. 0.292: ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend migration to Domain
Full migration of front\factory\ — entire directory removed (all 20 classes migrated). ProductRepository +20 frontend methods, PromotionRepository +5 applyType methods, TransportRepository +4 cached methods, PaymentMethodRepository +cached frontend methods. Fix: broken transports_list() in ajax.php replaced with forPaymentMethod(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
15
cron.php
15
cron.php
@@ -203,11 +203,12 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
|
||||
$products_array = [];
|
||||
foreach ( $products as $product )
|
||||
{
|
||||
$sku = \front\factory\ShopProduct::get_product_sku( $product['product_id'], true );
|
||||
$productRepo = new \Domain\Product\ProductRepository( $mdb );
|
||||
$sku = $productRepo->getSkuWithFallback( (int)$product['product_id'], true );
|
||||
|
||||
$products_array[] = [
|
||||
'idExternal' => $product['product_id'],
|
||||
'ean' => \front\factory\ShopProduct::get_product_ean( $product['product_id'], true ),
|
||||
'ean' => $productRepo->getEanWithFallback( (int)$product['product_id'], true ),
|
||||
'sku' => $sku ? $sku : md5( $product['product_id'] ),
|
||||
'originalName' => $product['name'],
|
||||
'originalPriceWithTax' => $product['price_brutto_promo'] ? str_replace( ',', '.', $product['price_brutto_promo'] ) : str_replace( ',', '.', $product['price_brutto'] ),
|
||||
@@ -301,7 +302,7 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
|
||||
'idExternal' => $order['id'],
|
||||
'isInvoice' => $order['firm_name'] ? true : false,
|
||||
'customerLogin' => $order['client_email'],
|
||||
'paymentType' => (int)\front\factory\ShopPaymentMethod::get_apilo_payment_method_id( $order['payment_method_id'] ),
|
||||
'paymentType' => (int)( new \Domain\PaymentMethod\PaymentMethodRepository( $mdb ) )->getApiloPaymentTypeId( (int)$order['payment_method_id'] ),
|
||||
'originalCurrency' => 'PLN',
|
||||
'originalAmountTotalWithTax' => str_replace( ',', '.', $order['summary'] ),
|
||||
'orderItems' => $products_array,
|
||||
@@ -322,12 +323,12 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
|
||||
'city' => $city,
|
||||
'zipCode' => $postal_code
|
||||
],
|
||||
'carrierAccount' => (int)\front\factory\ShopTransport::get_apilo_carrier_account_id( $order['transport_id'] ),
|
||||
'carrierAccount' => (int)( new \Domain\Transport\TransportRepository( $mdb ) )->getApiloCarrierAccountId( (int)$order['transport_id'] ),
|
||||
'orderNotes' => [ [
|
||||
'type' => 1,
|
||||
'comment' => 'Wiadomość do zamówienia:<br>' . $order['message'] . '<br><br>' . $order_message
|
||||
] ],
|
||||
'status' => (int)\front\factory\ShopStatuses::get_apilo_status_id( $order['status'] ),
|
||||
'status' => (int)( new \Domain\ShopStatus\ShopStatusRepository( $mdb ) )->getApiloStatusId( (int)$order['status'] ),
|
||||
'platformId' => $apilo_settings['platform-id']
|
||||
];
|
||||
|
||||
@@ -388,7 +389,7 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
|
||||
$postData['orderPayments'][] = [
|
||||
'amount' => str_replace( ',', '.', $order['summary'] ),
|
||||
'paymentDate' => $payment_date -> format('Y-m-d\TH:i:s\Z'),
|
||||
'type' => \front\factory\ShopPaymentMethod::get_apilo_payment_method_id( $order['payment_method_id'] )
|
||||
'type' => ( new \Domain\PaymentMethod\PaymentMethodRepository( $mdb ) )->getApiloPaymentTypeId( (int)$order['payment_method_id'] )
|
||||
];
|
||||
}
|
||||
|
||||
@@ -518,7 +519,7 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
|
||||
|
||||
if ( $responseData['id'] and $responseData['status'] )
|
||||
{
|
||||
$shop_status_id = \front\factory\ShopStatuses::get_shop_status_by_integration_status_id( 'apilo', $responseData['status'] );
|
||||
$shop_status_id = ( new \Domain\ShopStatus\ShopStatusRepository( $mdb ) )->getByIntegrationStatusId( 'apilo', (int)$responseData['status'] );
|
||||
|
||||
$order_tmp = new Order( $order['id'] );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user