Zaktualizuj wersję na 0.222, dodaj integrację z Orlen Paczka oraz wprowadź zmiany w obsłudze punktów Orlen w formularzach zamówień i koszyka

This commit is contained in:
2024-11-10 20:09:42 +01:00
parent bd48c7bc4e
commit be64e16dc7
19 changed files with 3509 additions and 3296 deletions

View File

@@ -1 +0,0 @@
YToyOntpOjA7aToxNjkzOTE3NzIzO2k6MTtzOjg6Ik1hcmlhbmVrIjt9

View File

@@ -1 +0,0 @@
YToyOntpOjA7aToxNjkzOTQ2ODIzO2k6MTtzOjI6InBsIjt9

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
YToyOntpOjA7aToxNzI0MjYzMTIxO2k6MTthOjM5OntzOjk6ImZpcm1fbmFtZSI7czo4OiJNYXJpYW5layI7czoxMToiZmlybV9hZHJlc3MiO3M6MDoiIjtzOjE1OiJhZGRpdGlvbmFsX2luZm8iO3M6MjQxOiI8cD48c3Ryb25nPk1hc3ogcHl0YW5pYT8gWmFkendvxYQgZG8gbmFzLjwvc3Ryb25nPjwvcD4NCg0KPHA+dGVsLiA8YSBocmVmPSJ0ZWw6Ly81MzA3NTU3NzQiPjUzMCA3NTUgNzc0PC9hPjxiciAvPg0KZW1haWw6Jm5ic3A7PGEgaHJlZj0ibWFpbHRvOnNrbGVwQG1hcmlhbmVrLnBsIj5za2xlcEBtYXJpYW5lay5wbDwvYT48YnIgLz4NCnVsLiBLcmFrb3dza2EgMTU2LzEwNCwgMzUtNTA2IFJ6ZXN6Jm9hY3V0ZTt3PC9wPg0KIjtzOjEyOiJjb250YWN0X2Zvcm0iO3M6MToiMSI7czoxMzoiY29udGFjdF9lbWFpbCI7czoxNzoic2tsZXBAbWFyaWFuZWsucGwiO3M6MTA6ImVtYWlsX2hvc3QiO3M6MTY6Im1haWwubWFyaWFuZWsucGwiO3M6MTA6ImVtYWlsX3BvcnQiO3M6MjoiMjUiO3M6MTE6ImVtYWlsX2xvZ2luIjtzOjE3OiJza2xlcEBtYXJpYW5lay5wbCI7czoxNDoiZW1haWxfcGFzc3dvcmQiO3M6OToiTGVnaWExOTE2IjtzOjExOiJnb29nbGVfbWFwcyI7czowOiIiO3M6MTM6ImZhY2Vib29rX2xpbmsiO3M6MDoiIjtzOjE0OiJzdGF0aXN0aWNfY29kZSI7czowOiIiO3M6ODoiaHRhY2Nlc3MiO3M6MDoiIjtzOjY6InJvYm90cyI7czowOiIiO3M6MjI6InNob3BfYmFua19hY2NvdW50X2luZm8iO3M6MjI4OiI8cD5Qcm9qZWN0LVBybzxiciAvPg0KTmVzdEJhbmsmbmJzcDs8c3Ryb25nPjIyIDI1MzAgMDAwOCAyMDUxIDEwNTAgNjc2MyAwMDAxPC9zdHJvbmc+PC9wPg0KDQo8cD5Ld290YTogPHN0cm9uZz5bS1dPVEFdPC9zdHJvbmc+PGJyIC8+DQpXIHR5dHVsZSBwcm9zesSZIHdwaXNhxIcgbnVtZXIgemFtJm9hY3V0ZTt3aWVuaWE6Jm5ic3A7PHN0cm9uZz5bTlItWkFNT1dJRU5JQV08L3N0cm9uZz48L3A+DQoiO3M6NjoidXBkYXRlIjtzOjE6IjEiO3M6MTQ6ImJvb3RfYW5pbWF0aW9uIjtzOjA6IiI7czoxNzoibmV3c2xldHRlcl9oZWFkZXIiO3M6MTYzOiI8ZGl2IHN0eWxlPSJib3JkZXItYm90dG9tOjVweCBzb2xpZCAjNzdjZGQxOyBwYWRkaW5nOjIwcHg7IHRleHQtYWxpZ246Y2VudGVyIj48aW1nIGFsdD0iIiBzcmM9Ii9sYXlvdXQvaW1hZ2VzL2xvZ28ucG5nIiBzdHlsZT0iaGVpZ2h0OjUwcHg7IHdpZHRoOjIwOHB4IiAvPjwvZGl2Pg0KIjtzOjE3OiJuZXdzbGV0dGVyX2Zvb3RlciI7czo2OTM6IjxkaXYgc3R5bGU9ImJvcmRlci10b3A6NXB4IHNvbGlkICM3N2NkZDE7IHBhZGRpbmc6MjBweCAyMHB4IDAgMjBweCI+DQo8cCBzdHlsZT0idGV4dC1hbGlnbjpjZW50ZXIiPjxzcGFuIHN0eWxlPSJmb250LXNpemU6MTJweCI+PGVtPlBvemRyYXdpYW15LDxiciAvPg0KWmVzcG9sIE1BUklBTkVLLlBMPGJyIC8+DQo8YSBocmVmPSJodHRwczovL3d3dy5tYXJpYW5lay5wbCI+d3d3Lm1hcmlhbmVrLnBsPC9hPjwvZW0+PC9zcGFuPjwvcD4NCg0KPHAgc3R5bGU9InRleHQtYWxpZ246Y2VudGVyIj48c3BhbiBzdHlsZT0iZm9udC1zaXplOjExcHgiPjxzcGFuIHN0eWxlPSJjb2xvcjojOTVhNWE2Ij5XaWFkb21vxZvEhyB6b3N0YcWCYSB3eWdlbmVyb3dhbmEgYXV0b21hdHljem5pZSwgcHJvc2lteSBuYSBuacSFIG5pZSBvZHBvd2lhZGHEhy4gJm5ic3A7QWJ5IHNrb250YWt0b3dhxIcgc2nEmSB6IHNlcndpc2VtIDxhIGhyZWY9Imh0dHBzOi8vd3d3Lm1hcmlhbmVrLnBsIj5NQVJJQU5FSy5QTDwvYT4sIHByb3NpbXkgbyBwcnplc8WCYW5pZSBlLW1haWxhIG5hIGFkcmVzJm5ic3A7PC9zcGFuPjxhIGhyZWY9Im1haWx0bzprb250YWt0QG1hcmlhbmVrLnBsIiB0YXJnZXQ9Il9ibGFuayI+PHNwYW4gc3R5bGU9ImNvbG9yOiM5NWE1YTYiPmtvbnRha3RAbWFyaWFuZWsucGw8L3NwYW4+PC9hPjwvc3Bhbj48L3A+DQo8L2Rpdj4NCiI7czoxMDoiaG90cGF5X2FwaSI7czo1OToiUkZSTmFHUk9ibXBuVEUxbWNtUlVNME5OZFRsTlJqWndSeTg0U1dsaFFXRTJhWHA1UzFKRVYwOHdjejAiO3M6NToiZGV2ZWwiO3M6MToiMCI7czozOiJzc2wiO3M6MToiMCI7czoxNDoiaHRhY2Nlc3NfY2FjaGUiO3M6MToiMSI7czoxMzoiZnJlZV9kZWxpdmVyeSI7czo1OiI5OS4wMCI7czoxODoicHJ6ZWxld3kyNF9zYW5kYm94IjtzOjE6IjAiO3M6MjI6InByemVsZXd5MjRfbWVyY2hhbnRfaWQiO3M6NjoiMTU2MTAxIjtzOjE4OiJwcnplbGV3eTI0X2NyY19rZXkiO3M6MTY6ImQ4NWFkOWRlOGNiYTBlMDEiO3M6MTA6InVwZGF0ZV9rZXkiO3M6MzI6ImZmZmE2ODNlYWVjMTU2ZGQwNGNiMDM3ZmU0ODMyZDY5IjtzOjc6InRwYXlfaWQiO3M6NToiNzQ2OTgiO3M6MTI6InRwYXlfc2FuZGJveCI7czoxOiIwIjtzOjE4OiJ0cGF5X3NlY3VyaXR5X2NvZGUiO3M6MTc6IilER01xPmt6eEApIzcwdmFyIjtzOjY6InBpa3NlbCI7czoxNjoiMjU2Nzk5OTIwMzMxNDI3NyI7czoxMzoiZ2VuZXJhdGVfd2VicCI7czoxOiIxIjtzOjEyOiJsYXp5X2xvYWRpbmciO3M6MToiMSI7czoxMjoiZWtvbWlfc3VydmV5IjtzOjA6IiI7czoyMToiZ29vZ2xlX3RhZ19tYW5hZ2VyX2lkIjtzOjEyOiJHVE0tUE03WjNMUjgiO3M6MTQ6ImluZmluaXRlc2Nyb2xsIjtzOjE6IjAiO3M6MjU6IndhcmVob3VzZV9tZXNzYWdlX3plcm9fcGwiO3M6MTY6IiFXeXN5xYJrYSBkbyAyNGgiO3M6Mjg6IndhcmVob3VzZV9tZXNzYWdlX25vbnplcm9fcGwiO3M6MTc6IiEhV3lzecWCa2EgZG8gMjRoIjt9fQ==

View File

@@ -42,6 +42,10 @@ ob_start();
<? $paczkomat = explode( '|', $this -> order[ 'inpost_paczkomat' ] );?>
<div>Paczkomat: <b id="order-paczkomat"><?= $paczkomat[0];?></b> | <?= $paczkomat[1];?> <i class="fa fa-copy" onclick="copyToClipboard( 'order-paczkomat' ); return false;"></i></div>
<? endif;?>
<? if ( $this -> order['transport_id'] == 9 and $this -> order[ 'orlen_point' ] ):?>
<? $orlen = explode( '|', $this -> order[ 'orlen_point' ] );?>
<div>Punkt Orlen: <b id="order-orlen"><?= $orlen[0];?></b> | <?= $orlen[1];?> <i class="fa fa-copy" onclick="copyToClipboard( 'order-orlen' ); return false;"></i></div>
<? endif;?>
<br/>
<div>
<b><?= $this -> order[ 'payment_method' ];?> </b>

View File

@@ -245,6 +245,18 @@ class ShopBasket
exit;
}
}
if ( \S::get_session( 'basket-transport-method-id' ) === '9' )
{
if ( !\S::get_session( 'basket_orlen_point_id' ) )
{
echo json_encode( [
'result' => 'bad'
] );
exit;
}
}
echo json_encode( [
'result' => 'ok'
] );
@@ -264,6 +276,16 @@ class ShopBasket
exit;
}
static public function orlen_save()
{
\S::set_session( 'basket_orlen_point_id', \S::get( 'orlen_point_id' ) );
\S::set_session( 'basket_orlen_point_info', \S::get( 'orlen_point_name' ) );
echo json_encode( [
'result' => 'ok'
] );
exit;
}
public static function inpost_save()
{
\S::set_session( 'basket-inpost-info', \S::get( 'paczkomat' ) );
@@ -343,9 +365,23 @@ class ShopBasket
}
if ( $order_id = \front\factory\ShopOrder::basket_save(
$client[ 'id' ], \S::get_session( 'basket' ), \S::get_session( 'basket-transport-method-id' ), \S::get_session( 'basket-payment-method-id' ),
\S::get( 'email', true ), \S::get( 'phone', true ), \S::get( 'name', true ), \S::get( 'surname', true ), \S::get( 'firm', true ), \S::get( 'street' ), \S::get( 'postal_code', true ), \S::get( 'city', true ),
\S::get_session( 'basket-inpost-info' ), \S::get_session( 'coupon' ), \S::get_session( 'basket_message' )
$client[ 'id' ],
\S::get_session( 'basket' ),
\S::get_session( 'basket-transport-method-id' ),
\S::get_session( 'basket-payment-method-id' ),
\S::get( 'email', true ),
\S::get( 'phone', true ),
\S::get( 'name', true ),
\S::get( 'surname', true ),
\S::get( 'firm', true ),
\S::get( 'street' ),
\S::get( 'postal_code', true ),
\S::get( 'city', true ),
\S::get_session( 'basket-inpost-info' ),
\S::get_session( 'basket_orlen_point_id' ),
\S::get_session( 'basket_orlen_point_info' ),
\S::get_session( 'coupon' ),
\S::get_session( 'basket_message' )
) )
{
\S::alert( \S::lang( 'zamowienie-zostalo-zlozone-komunikat' ) );
@@ -353,6 +389,8 @@ class ShopBasket
\S::delete_session( 'basket-transport-method-id' );
\S::delete_session( 'basket-payment-method-id' );
\S::delete_session( 'basket-inpost-info' );
\S::delete_session( 'basket_orlen_point_id' );
\S::delete_session( 'basket_orlen_point_info' );
\S::delete_session( 'coupon' );
\S::delete_session( 'basket_message' );

View File

@@ -64,7 +64,24 @@ class ShopOrder
return date( 'Y/m', strtotime( $date ) ) . '/' . $nr;
}
public static function basket_save( $client_id, $basket, $transport_id, $payment_id, $email, $phone, $name, $surname, $firm, $street, $postal_code, $city, $inpost_info, $coupon, $basket_message )
public static function basket_save(
$client_id,
$basket,
$transport_id,
$payment_id,
$email,
$phone,
$name,
$surname,
$firm,
$street,
$postal_code,
$city,
$inpost_info,
$orlen_point_id,
$orlen_point_info,
$coupon,
$basket_message )
{
global $mdb, $lang_id, $settings;
@@ -103,6 +120,7 @@ class ShopOrder
'transport' => $transport[ 'name_visible' ],
'transport_cost' => $transport_cost,
'transport_description' => $transport[ 'description' ],
'orlen_point' => ( $orlen_point_id ) ? $orlen_point_id . ' | ' . $orlen_point_info : null,
'inpost_paczkomat' => ( $transport_id == 1 or $transport_id == 2 ) ? $inpost_info : null,
'payment_method' => $payment_method[ 'name' ],
'payment_method_id' => $payment_id,

View File

@@ -52,7 +52,8 @@ $apilo_settings = \admin\factory\Integrations::apilo_settings();
$baselinker_settings = \admin\factory\Integrations::baselinker_settings();
$sellasist_settings = \admin\factory\Integrations::sellasist_settings();
function parsePaczkomatAddress($input) {
function parsePaczkomatAddress($input)
{
$pattern = '/^(\w+)\s+\|\s+([^,]+),\s+(\d{2}-\d{3})\s+(.+)$/';
if (preg_match($pattern, $input, $matches)) {
@@ -67,6 +68,21 @@ function parsePaczkomatAddress($input) {
}
}
function parseOrlenAddress( $input )
{
$pattern = '/^([^\|]+)\s*\|\s*([^,]+),\s*(.+?)\s+(\d{2}-\d{3})$/';
if (preg_match($pattern, $input, $matches)) {
return [
'code' => trim($matches[1]),
'address' => trim($matches[2]),
'city' => trim($matches[3]),
'postalCode' => trim($matches[4]),
];
} else {
return null;
}
}
function getImageUrlById($id) {
$apiUrl = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME'] . '/api/v1/product.php';
@@ -118,7 +134,7 @@ if ( $sellasist_settings['enabled'] and $sellasist_settings['sync_products'] and
$mdb -> update( 'pp_shop_products', [ 'price_netto' => \S::normalize_decimal( $price_netto, 2 ), 'price_brutto' => \S::normalize_decimal( $price_brutto, 2 ) ], [ 'sellasist_product_id' => $result['sellasist_product_id'] ] );
\admin\factory\ShopProduct::update_product_combinations_prices( $result['id'], $price_brutto, $vat, null );
\admin\factory\ShopProduct::update_product_combinations_prices( (int)$result['id'], $price_brutto, $vat, null );
}
// aktualizowanie stanu magazynowego
@@ -190,7 +206,7 @@ if ( $apilo_settings['enabled'] and $apilo_settings['access-token'] and ( !$apil
$mdb -> update( 'pp_shop_products', [ 'price_netto' => \S::normalize_decimal( $price_netto, 2 ), 'price_brutto' => \S::normalize_decimal( $price_brutto, 2 ) ], [ 'apilo_product_id' => $product_price['product'] ] );
$product_id = $mdb -> get( 'pp_shop_products', 'id', [ 'apilo_product_id' => $product_price['product'] ] );
\admin\factory\ShopProduct::update_product_combinations_prices( $product_id, $price_brutto, $vat, null );
\admin\factory\ShopProduct::update_product_combinations_prices( (int)$product_id, $price_brutto, $vat, null );
}
}
}
@@ -247,7 +263,7 @@ if ( $baselinker_settings['enabled'] and $baselinker_settings['sync_products'] a
$product_id = $mdb -> get( 'pp_shop_products', 'id', [ 'baselinker_product_id' => $baselinker_product_id ] );
$vat = $mdb -> get( 'pp_shop_products', 'vat', [ 'baselinker_product_id' => $baselinker_product_id ] );
\admin\factory\ShopProduct::update_product_combinations_prices( $product_id, $price_brutto, $vat, $price_brutto_promo );
\admin\factory\ShopProduct::update_product_combinations_prices( (int)$product_id, $price_brutto, $vat, $price_brutto_promo );
}
// aktualizowanie wagi
@@ -489,6 +505,29 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
$order_date = new DateTime( $order['date_order'] );
$paczkomatData = parsePaczkomatAddress( $order['inpost_paczkomat'] );
$orlenPointData = parseOrlenAddress( $order['orlen_point'] );
$street = '';
$city = '';
$postal_code = '';
if ( $order['client_street'] )
{
$street = $order['client_street'];
$city = $order['client_city'];
$postal_code = $order['client_postal_code'];
}
else if ( $paczkomatData )
{
$street = $paczkomatData['address'];
$city = $paczkomatData['city'];
$postal_code = $paczkomatData['postalCode'];
}
else if ( $orlenPointData )
{
$street = $orlenPointData['address'];
$city = $orlenPointData['city'];
$postal_code = $orlenPointData['postalCode'];
}
$postData = [
'idExternal' => $order['id'],
@@ -503,17 +542,17 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
'name' => $order['client_name'] . ' ' . $order['client_surname'],
'phone' => $order['client_phone'],
'email' => $order['client_email'],
'streetName' => $order['client_street'] ? $order['client_street'] : $paczkomatData['address'],
'city' => $order['client_city'] ? $order['client_city'] : $paczkomatData['city'],
'zipCode' => $order['client_postal_code'] ? $order['client_postal_code'] : $paczkomatData['postalCode']
'streetName' => $street,
'city' => $city,
'zipCode' => $postal_code
],
'addressDelivery' => [
'name' => $order['client_name'] . ' ' . $order['client_surname'],
'phone' => $order['client_phone'],
'email' => $order['client_email'],
'streetName' => $order['client_street'] ? $order['client_street'] : $paczkomatData['address'],
'city' => $order['client_city'] ? $order['client_city'] : $paczkomatData['city'],
'zipCode' => $order['client_postal_code'] ? $order['client_postal_code'] : $paczkomatData['postalCode']
'streetName' => $street,
'city' => $city,
'zipCode' => $postal_code
],
'carrierAccount' => (int)\front\factory\ShopTransport::get_apilo_carrier_account_id( $order['transport_id'] ),
'orderNotes' => [ [
@@ -544,6 +583,27 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
}
}
// jeżeli orlen paczka
if ( $order['orlen_point'] )
{
$postData['addressDelivery']['parcelName'] = $order['orlen_point'] ? 'Automat ORLEN ' . $order['orlen_point'] : null;
$postData['addressDelivery']['parcelIdExternal'] = $order['orlen_point'] ? ( $parcelId = trim( explode( '-', $order['orlen_point'] )[1] ) ) : null;
if ( !$postData['addressDelivery']['zipCode'] or !$postData['addressDelivery']['city'] )
{
preg_match("/\b\d{2}-\d{3}\b/", $order['orlen_point'], $postalCodeMatches);
$postalCode = $postalCodeMatches[0] ?? '';
$cityPattern = "/\d{2}-\d{3}\s+(.+)/";
preg_match($cityPattern, $order['orlen_point'], $cityMatches);
$city = $cityMatches[1] ?? '';
$postData['addressDelivery']['zipCode'] = $postalCode;
$postData['addressDelivery']['city'] = $city;
}
}
if ( $order['paid'] )
{
$payment_date = new DateTime( $order['date_order'] );

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -57,15 +57,15 @@
</div>
</div>
<div class="form-group">
<input type="text" id="street" name="street" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'ulica-i-nr-domu' ) );?> <? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" value="<?= htmlspecialchars( $address_current['street'] );?>">
<input type="text" id="street" name="street" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'ulica-i-nr-domu' ) );?> <? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" value="<?= htmlspecialchars( $address_current['street'] );?>">
</div>
<div class="form-group">
<div class="row">
<div class="col-12 col-md-6">
<input type="text" id="postal_code" name="postal_code" pattern="[0-9]{2}-[0-9]{3}" title="Format xx-xxx" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'kod-pocztowy' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" " value="<?= htmlspecialchars( $address_current['postal_code'] );?>">
<input type="text" id="postal_code" name="postal_code" pattern="[0-9]{2}-[0-9]{3}" title="Format xx-xxx" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'kod-pocztowy' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" " value="<?= htmlspecialchars( $address_current['postal_code'] );?>">
</div>
<div class="col-12 col-md-6">
<input type="text" id="city" name="city" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'miasto' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" " value="<?= htmlspecialchars( $address_current['city'] );?>">
<input type="text" id="city" name="city" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'miasto' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" " value="<?= htmlspecialchars( $address_current['city'] );?>">
</div>
</div>
</div>

View File

@@ -44,6 +44,17 @@ if ( is_array( $this -> transports_methods ) )
<? endif;?>
</div>
<? endif;?>
<? if ( $transport_method['id'] == 9 ):?>
<div class="orlen-info orlen-info-<?= $transport_method['id'];?>">
<input type="hidden" name="orlen_point_id" id="orlen_point_id" value="<?= \S::get_session( 'basket_orlen_point_id' );?>">
<span id="orlen_point_info" <? if ( \S::get_session( 'basket-transport-method-id' ) != 9 ):?>style="display: none;" <? endif;?>><?= \S::get_session( 'basket_orlen_point_info' );?></span>
<? if ( \S::get_session( 'basket_orlen_point_info' ) ):?>
<a href="#" class="orlen-widget" data-target="#orlen_point_id" data-label="#orlen_point_info" data-type="all" data-layout="tabs" onclick="return false;"><?= \S::lang( 'zmien' );?></a>
<? else:?>
<a href="#" class="orlen-widget" data-target="#orlen_point_id" data-label="#orlen_point_info" data-type="all" data-layout="tabs" onclick="return false;"><?= \S::lang( 'wybierz' );?></a>
<? endif;?>
</div>
<? endif;?>
<? endforeach; endif;?>
<script class="footer" type="text/javascript">
$( function() {

View File

@@ -1,37 +1,47 @@
<div id="basket-container">
<div id="content">
<?= $this -> basket_details;?>
<?= $this->basket_details; ?>
</div>
<div id="paypo-promo">
Chcesz skorzystać z odroczonych płatności <img src="/layout/images/paypo-logo.svg">? Wybierz jedną z form dostawy: <strong>odbiór osobisty, Paczkomaty InPost - przedpłata lub Kurier - przedpłata</strong>.<br/>
Chcesz skorzystać z odroczonych płatności <img src="/layout/images/paypo-logo.svg">? Wybierz jedną z form dostawy: <strong>odbiór osobisty, Paczkomaty InPost - przedpłata lub Kurier - przedpłata</strong>.<br />
Wartość zamówienia musi mieścić się w przedziale od 40 zł do 1000 zł.
</div>
<? if ( is_array( $this -> basket ) and count( $this -> basket ) ):?>
<? if (is_array($this->basket) and count($this->basket)): ?>
<div class="basket-options">
<div class="content">
<div class="left">
<div class="box-title"><?= ucfirst( \S::lang( 'dostawa' ) );?>:</div>
<div class="box-title"><?= ucfirst(\S::lang('dostawa')); ?>:</div>
<div id="transport-methods">
<?= $this -> transport_methods;?>
<?= $this->transport_methods; ?>
</div>
<div class="inpost-map-container">
<a href="#" onclick="inpost_check(); return false;" class="inpost-hide"><?= \S::lang( 'zamknij' );?></a>
<a href="#" onclick="inpost_check(); return false;" class="inpost-hide"><?= \S::lang('zamknij'); ?></a>
<div id="inpost-map"></div>
</div>
</div>
<div class="right">
<div class="box-title"><?= ucfirst( \S::lang( 'platnosc' ) );?>:</div>
<div class="box-title"><?= ucfirst(\S::lang('platnosc')); ?>:</div>
<div id="payment-methods"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<a href="/koszyk-podsumowanie" id="btn-basket-summary" class="btn btn-success disabled float-right"><span class="text"><?= ucfirst( \S::lang( 'przejdz-do-podsumowania' ) );?></span></a>
<a href="/koszyk-podsumowanie" id="btn-basket-summary" class="btn btn-success disabled float-right"><span class="text"><?= ucfirst(\S::lang('przejdz-do-podsumowania')); ?></span></a>
</div>
</div>
<? endif;?>
<? endif; ?>
</div>
<script>
(function(o, r, l, e, n) {
o[l] = o[l] || [];
var f = r.getElementsByTagName('head')[0];
var j = r.createElement('script');
j.async = true;
j.src = e + 'widget.js?token=' + n + '&v=1.0.0&t=' + Math.floor(new Date().getTime() / 1000);
f.insertBefore(j, f.firstChild);
})(window, document, 'orlenpaczka', 'https://mapa.orlenpaczka.pl/', '0e365de8e228096aaf033ca8e43db5603132d8d5659788dbcb4bd936c852753e51b5382036641163788c1644ea631564f90a445402cd756ed40b491d');
</script>
<link class="footer" rel="stylesheet" type="text/css" href="/libraries/grid/plugins/icheck/skins/square/_all.css">
<link class="footer" rel="stylesheet" type="text/css" href="https://geowidget.easypack24.net/css/easypack.css">
<script class="footer" type="text/javascript" src="/libraries/grid/plugins/icheck/icheck.min.js"></script>
@@ -48,59 +58,51 @@
beforeSend: function() {
},
success: function( response ) {
data = jQuery.parseJSON( response );
if ( data.result == 'bad' ) {
$( '.inpost-info-' + inpost_transport_method_id ).html( '<a href="#" onclick="inpost_map( ' + inpost_transport_method_id + ' ); return false;">wybierz</a>' );
success: function(response) {
data = jQuery.parseJSON(response);
if (data.result == 'bad') {
$('.inpost-info-' + inpost_transport_method_id).html('<a href="#" onclick="inpost_map( ' + inpost_transport_method_id + ' ); return false;">wybierz</a>');
}
$( '.inpost-map-container' ).hide();
$('.inpost-map-container').hide();
}
});
return false;
}
function payment_checked( payment_method_id )
{
$.ajax(
{
function payment_checked(payment_method_id) {
$.ajax({
type: 'POST',
cache: false,
url: '/shopBasket/basket_payment_method_set',
data:
{
data: {
payment_method_id: payment_method_id
},
beforeSend: function()
{
$( '#basket-container *' ).addClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
beforeSend: function() {
$('#basket-container *').addClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('disable');
},
success: function( response )
{
response = jQuery.parseJSON( response );
$( '#basket-container *' ).removeClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
$( '#btn-basket-summary' ).removeClass( 'disabled' );
success: function(response) {
response = jQuery.parseJSON(response);
$('#basket-container *').removeClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('enable');
$('#btn-basket-summary').removeClass('disabled');
}
});
return false;
}
function inpost_map( transport_method_id )
{
function inpost_map(transport_method_id) {
inpost_transport_method_id = transport_method_id;
window.easyPackAsyncInit = function () {
window.easyPackAsyncInit = function() {
easyPack.init({
mapType: 'osm',
searchType: 'osm',
});
var map = easyPack.mapWidget( 'inpost-map', function(point)
{
$.ajax(
{
var map = easyPack.mapWidget('inpost-map', function(point) {
$.ajax({
type: 'POST',
cache: false,
url: '/shopBasket/inpost_save',
@@ -108,64 +110,104 @@
paczkomat: point.name + ' | ' + point.address.line1 + ', ' + point.address.line2
},
beforeSend: function() {},
success: function( response ) {
$( '.inpost-info-' + transport_method_id ).html( point.name + ' | ' + point.address.line1 + ', ' + point.address.line2 + '<a href="#" onclick="inpost_map( ' + transport_method_id + ' ); return false;">zmień</a>' );
$( '.inpost-map-container' ).hide();
success: function(response) {
$('.inpost-info-' + transport_method_id).html(point.name + ' | ' + point.address.line1 + ', ' + point.address.line2 + '<a href="#" onclick="inpost_map( ' + transport_method_id + ' ); return false;">zmień</a>');
$('.inpost-map-container').hide();
}
});
});
};
$( '.inpost-map-container' ).show();
$('.inpost-map-container').show();
}
function transport_checked( transport_method_id, payment_method_id, event_click )
{
function transport_checked(transport_method_id, payment_method_id, event_click) {
$.ajax({
type: 'POST',
cache: false,
url: '/shopBasket/basket_payments_methods',
data:
{
data: {
payment_method_id: payment_method_id,
transport_method_id: transport_method_id
},
beforeSend: function()
{
$( '#basket-container *' ).addClass( 'disabled' );
$( '#transport-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
beforeSend: function() {
$('#basket-container *').addClass('disabled');
$('#transport-methods .icheck, #transport-methods .icheck').iCheck('disable');
},
success: function( response )
{
response = jQuery.parseJSON( response );
$( '#basket-container *' ).removeClass( 'disabled' );
$( '#transport-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
$( '#payment-methods' ).html( response.payment_methods );
$( '#payment-methods .icheck' ).iCheck({
success: function(response) {
response = jQuery.parseJSON(response);
$('#basket-container *').removeClass('disabled');
$('#transport-methods .icheck, #transport-methods .icheck').iCheck('enable');
$('#payment-methods').html(response.payment_methods);
$('#payment-methods .icheck').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue'
});
if ( payment_method_id )
$( '#btn-basket-summary' ).removeClass( 'disabled' );
if (payment_method_id)
$('#btn-basket-summary').removeClass('disabled');
$( '#payment-methods .icheck' ).on( 'ifChecked', function( event )
{
var payment_method_id = $( this ).val();
payment_checked( payment_method_id );
$('#payment-methods .icheck').on('ifChecked', function(event) {
var payment_method_id = $(this).val();
payment_checked(payment_method_id);
});
if ( event_click && ( transport_method_id == '1' || transport_method_id == '2' ) )
{
$.ajax({
type: 'POST',
cache: false,
url: '/shopBasket/inpost_save',
data: {
paczkomat: null
},
beforeSend: function() {},
success: function(response) {}
});
$( '#orlen_point_id' ).val( '' );
$( '#orlen_point_info' ).html( '' );
$( '.orlen-widget' ).hide();
inpost_map( transport_method_id )
}
if ( event_click && transport_method_id == '9' )
{
$( '.inpost-info' ).html( '' );
$( '#orlen_point_info' ).show();
document.querySelectorAll('.orlen-widget').forEach(function(element) {
element.style.display = 'inline-block'; // Ustawia widoczność elementu
element.click(); // Wywołuje kliknięcie na elemencie
});
}
if ( event_click && transport_method_id != 1 )
{
$.ajax({
type: 'POST',
cache: false,
url: '/shopBasket/inpost_save',
data: {
paczkomat: null
},
beforeSend: function() {},
success: function(response) {}
});
$( '.inpost-info' ).html( '' );
}
if ( event_click && transport_method_id != 9 )
{
$( '#orlen_point_id' ).val( '' );
$( '#orlen_point_info' ).html( '' );
$( '.orlen-widget' ).hide();
}
}
});
return false;
}
$( function()
{
$( 'body' ).on( 'change', '#basket .basket-product-message textarea', function()
{
var _this = $( this);
$(function() {
$('body').on('change', '#basket .basket-product-message textarea', function() {
var _this = $(this);
$.ajax({
type: 'POST',
@@ -173,14 +215,14 @@
url: '/shopBasket/product_message_change',
data: {
product_message: _this.val(),
position_code: _this.attr( 'position' )
position_code: _this.attr('position')
},
beforeSend: function() {},
success: function() {}
});
});
$( 'body' ).on( click_event, '#btn-basket-summary', function(e) {
$('body').on(click_event, '#btn-basket-summary', function(e) {
e.preventDefault();
$.ajax({
@@ -189,18 +231,18 @@
url: '/shopBasket/transport_method_inpost_check',
data: {},
beforeSend: function() {
$( '#basket-container *' ).addClass( 'disabled' );
$('#basket-container *').addClass('disabled');
},
success: function( response ) {
success: function(response) {
data = jQuery.parseJSON( response );
$( '#basket-container *' ).removeClass( 'disabled' );
if ( data.result === 'bad' ) {
data = jQuery.parseJSON(response);
$('#basket-container *').removeClass('disabled');
if (data.result === 'bad') {
$.alert({
title: '<?= ucfirst( \S::lang( 'uwaga' ) );?>',
content: 'Proszę wybrać paczkomat.',
title: '<?= ucfirst(\S::lang('uwaga')); ?>',
content: 'Proszę wybrać punkt odbioru.',
type: 'blue',
closeIcon: true,
closeIconClass: 'fas fa-times',
@@ -209,13 +251,12 @@
useBootstrap: false,
theme: 'modern',
autoClose: 'confirm|5000',
icon: 'fas fa-exclamation',
buttons: {
confirm: {
text: '<?= \S::lang( 'zamknij' );?>',
text: '<?= \S::lang('zamknij'); ?>',
btnClass: 'btn-blue',
keys: ['enter'],
action: function () {}
action: function() {}
}
}
});
@@ -226,9 +267,8 @@
});
});
$( 'body' ).on( 'change', '#basket-message', function()
{
var _this = $( this);
$('body').on('change', '#basket-message', function() {
var _this = $(this);
$.ajax({
type: 'POST',
cache: false,
@@ -237,62 +277,56 @@
basket_message: _this.val()
},
beforeSend: function() {
$( '#basket-container *' ).addClass( 'disabled' );
$('#basket-container *').addClass('disabled');
},
success: function( response ) {
data = jQuery.parseJSON( response );
success: function(response) {
data = jQuery.parseJSON(response);
$( '#basket-container *' ).removeClass( 'disabled' );
$('#basket-container *').removeClass('disabled');
}
});
});
$( 'body' ).on( 'change', '.basket-product .int-format', function()
{
var product_hash = $( this ).attr( 'product-hash' );
var quantity = $( this ).val();
$('body').on('change', '.basket-product .int-format', function() {
var product_hash = $(this).attr('product-hash');
var quantity = $(this).val();
$.ajax(
{
$.ajax({
type: 'POST',
cache: false,
url: '/shopBasket/basket_change_quantity_product',
data:
{
data: {
product_hash: product_hash,
quantity: quantity
},
beforeSend: function()
{
$( '#basket-container *' ).addClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
beforeSend: function() {
$('#basket-container *').addClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('disable');
},
success: function( response )
{
data = jQuery.parseJSON( response );
success: function(response) {
data = jQuery.parseJSON(response);
if ( data.products_count === 0 )
{
if (data.products_count === 0) {
document.location.href = '/koszyk';
$( '.mini-box' ).hide();
$('.mini-box').hide();
return false;
}
$( '#basket-container *' ).removeClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
$( '#basket-container #content' ).html( data.basket );
$('#basket-container *').removeClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('enable');
$('#basket-container #content').html(data.basket);
$( '#basket-mini #products-count' ).html( data.basket_mini_count );
$( '#basket-mini #basket-value').html( data.basket_mini_value );
$('#basket-mini #products-count').html(data.basket_mini_count);
$('#basket-mini #basket-value').html(data.basket_mini_value);
$( '#basket-container #transport-methods' ).html( data.transport_methods );
$('#basket-container #transport-methods').html(data.transport_methods);
}
});
return false;
});
$( 'body' ).on( click_event, '.basket-product .btn-minus', function() {
var product_hash = $( this ).attr( 'product-hash' );
$('body').on(click_event, '.basket-product .btn-minus', function() {
var product_hash = $(this).attr('product-hash');
$.ajax({
type: 'POST',
@@ -302,38 +336,36 @@
product_hash: product_hash
},
beforeSend: function() {
$( '#basket-container *' ).addClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
$('#basket-container *').addClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('disable');
},
success: function( response ) {
success: function(response) {
data = jQuery.parseJSON( response );
data = jQuery.parseJSON(response);
if ( data.products_count === 0 ) {
if (data.products_count === 0) {
document.location.href = '/koszyk';
$( '.mini-box' ).hide();
$('.mini-box').hide();
return false;
}
$( '#basket-container *' ).removeClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
$( '#basket-container #content' ).html( data.basket );
$('#basket-container *').removeClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('enable');
$('#basket-container #content').html(data.basket);
$( '#basket-mini #products-count' ).html( data.basket_mini_count );
$( '#basket-mini #basket-value').html( data.basket_mini_value );
$('#basket-mini #products-count').html(data.basket_mini_count);
$('#basket-mini #basket-value').html(data.basket_mini_value);
$( '#basket-container #transport-methods' ).html( data.transport_methods );
$('#basket-container #transport-methods').html(data.transport_methods);
}
});
return false;
});
$( 'body' ).on( click_event, '.basket-product .btn-plus', function()
{
var product_hash = $( this ).attr( 'product-hash' );
$('body').on(click_event, '.basket-product .btn-plus', function() {
var product_hash = $(this).attr('product-hash');
$.ajax(
{
$.ajax({
type: 'POST',
cache: false,
url: '/shopBasket/basket_increase_quantity_product',
@@ -341,39 +373,37 @@
product_hash: product_hash
},
beforeSend: function() {
$( '#basket-container *' ).addClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
$('#basket-container *').addClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('disable');
},
success: function( response ) {
data = jQuery.parseJSON( response );
success: function(response) {
data = jQuery.parseJSON(response);
if ( data.products_count === 0 )
{
if (data.products_count === 0) {
document.location.href = '/koszyk';
$( '.mini-box' ).hide();
$('.mini-box').hide();
return false;
}
$( '#basket-container *' ).removeClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
$( '#basket-container #content' ).html( data.basket );
$('#basket-container *').removeClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('enable');
$('#basket-container #content').html(data.basket);
$( '#basket-mini #products-count' ).html( data.basket_mini_count );
$( '#basket-mini #basket-value').html( data.basket_mini_value );
$('#basket-mini #products-count').html(data.basket_mini_count);
$('#basket-mini #basket-value').html(data.basket_mini_value);
$( '#basket-container #transport-methods' ).html( data.transport_methods );
$('#basket-container #transport-methods').html(data.transport_methods);
}
});
return false;
});
$( 'body' ).on( click_event, '.basket-product .btn-delete', function()
{
var product_hash = $( this ).attr( 'product-hash' );
$('body').on(click_event, '.basket-product .btn-delete', function() {
var product_hash = $(this).attr('product-hash');
$.alert({
title: '<?= ucfirst( \S::lang( 'potwierdz' ) );?>',
content: '<?= \S::lang( 'potwierdz-usuniecie-produktu-z-koszyka' );?>',
title: '<?= ucfirst(\S::lang('potwierdz')); ?>',
content: '<?= \S::lang('potwierdz-usuniecie-produktu-z-koszyka'); ?>',
closeIcon: true,
closeIconClass: 'fas fa-close',
typeAnimated: true,
@@ -383,7 +413,7 @@
autoClose: 'cancel|10000',
buttons: {
confirm: {
text: '<?= \S::lang( 'usun' );?>',
text: '<?= \S::lang('usun'); ?>',
btnClass: 'btn-orange',
keys: ['enter'],
action: function() {
@@ -395,34 +425,32 @@
product_hash: product_hash
},
beforeSend: function() {
$( '#basket-container *' ).addClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
$('#basket-container *').addClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('disable');
},
success: function( response )
{
data = jQuery.parseJSON( response );
success: function(response) {
data = jQuery.parseJSON(response);
if ( data.products_count === 0 )
{
if (data.products_count === 0) {
document.location.href = '/koszyk';
$( '.mini-box' ).hide();
$('.mini-box').hide();
return false;
}
$( '#basket-container *' ).removeClass( 'disabled' );
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
$( '#basket-container #content' ).html( data.basket );
$('#basket-container *').removeClass('disabled');
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('enable');
$('#basket-container #content').html(data.basket);
$( '#basket-mini #products-count' ).html( data.basket_mini_count );
$( '#basket-mini #basket-value').html( data.basket_mini_value );
$('#basket-mini #products-count').html(data.basket_mini_count);
$('#basket-mini #basket-value').html(data.basket_mini_value);
$( '#basket-container #transport-methods' ).html( data.transport_methods );
$('#basket-container #transport-methods').html(data.transport_methods);
}
});
}
},
cancel: {
text: '<?= \S::lang( 'zamknij' );?>',
text: '<?= \S::lang('zamknij'); ?>',
btnClass: 'btn-blue',
action: function() {}
}
@@ -431,4 +459,52 @@
return false;
});
});
// zapisywanie wybranego orlen punktu
document.addEventListener('DOMContentLoaded', function() {
// Znajdź element #orlen_point_id
var orlenPointElement = document.querySelector('#transport-methods #orlen_point_id');
if (orlenPointElement) {
// Utwórz observer, który będzie reagował na zmiany w atrybucie value
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type === 'attributes' && mutation.attributeName === 'value') {
var orlen_point_id = orlenPointElement.value;
var orlen_point_name = document.querySelector('#orlen_point_info').textContent;
// Przygotuj dane jako form-urlencoded
var formData = new URLSearchParams();
formData.append('orlen_point_id', orlen_point_id);
formData.append('orlen_point_name', orlen_point_name);
// Wykonaj żądanie AJAX
fetch('/shopBasket/orlen_save', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: formData,
cache: 'no-cache'
})
.then(response => response.text())
.then(data => {
// Obsługa odpowiedzi
console.log('Odpowiedź serwera:', data);
})
.catch(error => {
console.error('Błąd podczas wykonywania żądania:', error);
});
}
});
});
// Konfiguracja observera do śledzenia zmian atrybutów
observer.observe(orlenPointElement, {
attributes: true
});
} else {
console.warn('#orlen_point_id nie został znaleziony.');
}
});
</script>

View File

@@ -37,6 +37,9 @@ echo $this -> settings['newsletter_header'];
<? if ( $this -> order['inpost_paczkomat'] ):?>
<br /><br />Paczkomat: <b><?= $this -> order['inpost_paczkomat'];?>
<? endif;?>
<? if ( $this -> order['orlen_point'] ):?>
<br /><br />Punkt Orlen: <b><?= $this -> order['orlen_point'];?>
<? endif;?>
</p>
<div style="border-bottom: 1px solid #eee; margin-bottom: 15px;"></div>
<p style="font-family: Arial; font-size: 14px; font-weight: 600; text-transform: uppercase;"><?= \S::lang( 'zamowione-produkty' );?>:</p>

BIN
updates/0.20/ver_0.222.zip Normal file

Binary file not shown.

View File

@@ -0,0 +1,3 @@
INSERT INTO pp_shop_transports (`id`, `name`, `name_visible`, `description`, `status`, `cost`, `max_wp`, `delivery_free`) VALUES (10, 'Orlen Paczka - przedpłata', '<b>Orlen Paczka</b> - przedpłata', 'Czas wysyłki 24h od czasu realizacji zamówienia', 0, 20, 10, 0);
ALTER TABLE `pp_shop_orders` ADD COLUMN `orlen_punkt` VARCHAR(255) NULL DEFAULT NULL AFTER `transport_description`;
ALTER TABLE `pp_shop_orders` CHANGE COLUMN `orlen_punkt` `orlen_point` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_polish_ci' AFTER `transport_description`;

View File

@@ -1,3 +1,6 @@
<b>ver. 0.222</b><br />
- NEW - integracja z Orlen Paczka
<hr>
<b>ver. 0.221</b><br />
- NEW - Automatyczne przekierowania adresów URL produktów, zmiany w pliku htaccess
<hr>

View File

@@ -1,5 +1,5 @@
<?
$current_ver = 221;
$current_ver = 222;
for ($i = 1; $i <= $current_ver; $i++)
{