Error in PHP and VAT allocation #142619
-
On the one hand, I get ongoing error logs with the following content: [25-Oct-2024 14:09:06 UTC] Request URI: /shop/stc45/index.php?cmd=display_logs, IP address: 2003:c3:e71d:8c00:79ce:6ddb:ba6b:e197, Language id 43 [25-Oct-2024 14:09:06 UTC] Request URI: /shop/stc45/index.php?cmd=display_logs, IP address: 2003:c3:e71d:8c00:79ce:6ddb:ba6b:e197, Language id 43 [25-Oct-2024 14:09:06 UTC] Request URI: /shop/stc45/index.php?cmd=display_logs, IP address: 2003:c3:e71d:8c00:79ce:6ddb:ba6b:e197, Language id 43 [25-Oct-2024 14:09:06 UTC] Request URI: /shop/stc45/index.php?cmd=display_logs, IP address: 2003:c3:e71d:8c00:79ce:6ddb:ba6b:e197, Language id 43 [25-Oct-2024 14:09:06 UTC] Request URI: /shop/stc45/index.php?cmd=display_logs, IP address: 2003:c3:e71d:8c00:79ce:6ddb:ba6b:e197, Language id 43 Furthermore, I entered the correct VAT for Germany in the tax allocation: 7%, 19% and 0%. However, I entered normal tax in the article yesterday and suddenly it is 20% and today it is 39%. Who adds that up? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hallo 3dstc, den Fehler kann man schlecht nachvollziehen, ohne dass du den Source Code zur Verfügung stellst, der die Fehler verursacht. Viele Grüße, |
Beta Was this translation helpful? Give feedback.
-
Hätte jemand eine idee mit meinem fehler ? |
Beta Was this translation helpful? Give feedback.
-
Leider ist der Fehler immer noch im aktuellen Shop und hindert am Verkauf die Fehlermeldung deutet auf einen Fehler in /includes/modules/shipping/packlink/packlink.php hin in den Zeilen 37 bis 42 installed = defined('MODULE_PACKLINK_API_KEY'); $this->setting_api_key = defined('MODULE_PACKLINK_API_KEY') ? MODULE_PACKLINK_API_KEY : null; $this->setting_size_rate = defined('MODULE_PACKLINK_SIZE_RATE') ? MODULE_PACKLINK_SIZE_RATE : null; $this->setting_weight_rate = defined('MODULE_PACKLINK_WEIGHT_RATE') ? MODULE_PACKLINK_WEIGHT_RATE : null; $this->apiConnector = new PacklinkSDK($this->setting_api_key, $this); // order trigger, if update order we need to get the old status $action = isset($_GET['action']) ? $_GET['action'] : null; $order_id = isset($_GET['oID']) ? $_GET['oID'] : null; $status = isset($_POST['status']) ? $_POST['status'] : null; $use_trigger = (floatval(PROJECT_VERSION_MINOR)>=5.5); if (!$use_trigger && $action=='edit' && $order_id && !$status && !@$_GET['skip']) { if ($this->mustExportOrder($order_id)) { include(DIR_WS_CLASSES . 'order.php'); $this->exportOrder($order_id); $messageStack->add_session('Order sended to Packlink ', 'success'); zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array()).'skip=1', 'NONSSL')); } } if ($use_trigger && $action=='update_order' && $order_id && $status=='2') { $old_order_status = (int)$this->getCurrentOrderStatus($order_id); $new_order_status = (int)$status; if ($old_order_status!=$new_order_status) { $zco_notifier->attach($this, array('ORDER_QUERY_ADMIN_COMPLETE')); } } } public function updateConfiguration($config) { global $db; $setting_api_key = $config['setting_api_key']; $setting_size_rate = $config['setting_size_rate']; $setting_weight_rate = $config['setting_weight_rate']; $db->Execute('UPDATE '.TABLE_CONFIGURATION.' SET configuration_value = "'.$setting_api_key.'" WHERE configuration_key = "MODULE_PACKLINK_API_KEY" '); $db->Execute('UPDATE '.TABLE_CONFIGURATION.' SET configuration_value = "'.$setting_size_rate.'" WHERE configuration_key = "MODULE_PACKLINK_SIZE_RATE" '); $db->Execute('UPDATE '.TABLE_CONFIGURATION.' SET configuration_value = "'.$setting_weight_rate.'" WHERE configuration_key = "MODULE_PACKLINK_WEIGHT_RATE" '); $this->setting_api_key = $setting_api_key; $this->setting_size_rate = $setting_size_rate; $this->setting_weight_rate = $setting_weight_rate; } private function mustExportOrder($order_id) { global $db; $sql = 'SELECT orders_status,packlink_draft_reference FROM '.TABLE_ORDERS.' WHERE orders_id = '.(int)$order_id; $row = $db->Execute($sql); return ((int)$row->fields['orders_status']==2 && $row->fields['packlink_draft_reference']==''); } private function getCurrentOrderStatus($order_id) { global $db; $sql = 'SELECT orders_status FROM '.TABLE_ORDERS.' WHERE orders_id = '.(int)$order_id; $row = $db->Execute($sql); return $row->fields['orders_status']; } public function log($msg) { if ($this->debug) { if (is_array($msg)) $msg = print_r($msg,true); $file = DIR_FS_LOGS.'/packlink.log'; error_log( strftime("%Y-%m-%d %H:%M:%S").' '.$msg."\n", 3, $file); } } /* HOOKED TO ORDER_QUERY_ADMIN_COMPLETE */ public function update(&$class, $eventID, $paramsArray = array()) { if ($this->lock) return false; $this->lock = true; // some triger while be fired twice $order_id = isset($_GET['oID']) ? $_GET['oID'] : null; $status = isset($_POST['status']) ? (int)$_POST['status'] : null; $this->log('ON UPDATE ORDER STATUS '.$order_id.' '.$status); if ($status===2) $this->exportOrder($order_id); } private function exportOrder($order_id) { global $db; $this->log('EXPORT ORDER '.$order_id); $order = new order($order_id); $exportable = (int)$order->info['orders_status']==2; $result = $db->Execute('SELECT packlink_draft_reference FROM '.TABLE_ORDERS.' WHERE orders_id = '.(int)$order_id); $exported = (bool)$result->fields['packlink_draft_reference']; if ($exportable && !$exported) { $shipments_datas = $this->getShipmentsDatas($order); $this->log($shipments_datas); // creation du draft $pl_reference = $this->apiConnector->createDraft($shipments_datas); //echo dev($pl_reference); // mise a jour des info packlink pour cette commande $packlink_draft_reference = $pl_reference ? $pl_reference->reference : null; if ($packlink_draft_reference) { $this->log('packlink_draft_reference = '.$packlink_draft_reference); $db->Execute('UPDATE '.TABLE_ORDERS.' SET packlink_draft_reference = "'.$packlink_draft_reference.'" WHERE orders_id = '.(int)$order_id); } } else { $this->log('ALREADY EXPORTED ! ORDER '.$order_id); } } private function getProductInfo($product_id) { global $db; $language_id = 1; $sql = " SELECT p.products_id, p.products_weight FROM ".TABLE_PRODUCTS." p WHERE p.products_id = ".(int)$product_id." "; $result = $db->Execute($sql); return $result->fields; } private function getCountryCode($country_name) { global $db; $sql = 'SELECT countries_iso_code_2 FROM '.TABLE_COUNTRIES.' WHERE countries_name = "'.$country_name.'"'; $result = $db->Execute($sql); return $result->fields['countries_iso_code_2']; } public function getStoreCountryCode() { $country_id = STORE_COUNTRY; // zen_get_countries is not the same in bo (another useless function) global $db; $sql = 'SELECT countries_iso_code_2 FROM '.TABLE_COUNTRIES.' WHERE countries_id = "'.$country_id.'"'; $result = $db->Execute($sql); return $result->fields['countries_iso_code_2']; } private function getShipmentsDatas($order) { /* - pb du firstname/lastname - pb width/height/length */ // mapping $names = explode(' ',$order->delivery['name']); $name = array_shift($names); //first_name $surname = implode(' ',$names); //last_name $company = $order->delivery['company']; $street1 = $order->delivery['street_address']; $street2 = $order->delivery['suburb']; $zip_code = $order->delivery['postcode']; $city = $order->delivery['city']; $country = $this->getCountryCode($order->delivery['country']); $state = $order->delivery['state']; $phone = $order->customer['telephone']; $email = $order->customer['email_address']; // get extra data via sdk : $postal_zone_id_to + $zip_code_id_to $datas_client = $this->apiConnector->getCitiesByPostCode($zip_code, $country); $postal_zone_id_to = $datas_client[0]->postalZone->id; $zip_code_id_to = $datas_client[0]->id; if (count($datas_client) > 1) { foreach ($datas_client as $key => $value) { $city = strtolower($city); $arr = array("-", "/", ",", "_"); $city_formated = str_replace($arr, " ", $city); $city_formated_pl = strtolower(str_replace($arr, " ", $value->city->name)); if ($city_formated_pl == $city_formated) { $postal_zone_id_to = $value->postalZone->id; $zip_code_id_to = $value->id; } } } // build Shipments Datas $shipments_datas = array( 'to' => array( 'name' => $name, 'surname' => $surname, 'company' => $company, 'street1' => $street1, 'street2' => $street2, 'zip_code' => $zip_code, 'city' => $city, 'country' => $country, 'state' => $state, 'phone' => $phone, 'email' => $email, ), 'additional_data' => array( 'postal_zone_id_to' => $postal_zone_id_to, 'zip_code_id_to' => $zip_code_id_to, ), 'contentvalue' => 0, 'source' => 'module_zencart', 'content' => '', ); // packages $num_items = count( $order->products ); if ($num_items>1) { $shipments_datas['packages'][] = array( 'weight' => 0, 'length' => 0, 'width' => 0, 'height' => 0 ); } $cmpt = 0; foreach ($order->products as $row) { $product_id = $row['id']; $quantity = $row['qty']; $item_id = $product_id; $price = round($row['final_price'],2); $tax = round($row['tax'],2); $price += $tax; $title = $row['name']; if (isset($row['attributes'])) { $title .= ' - '; foreach ($row['attributes'] as $attribute) { $title .= ', '.$attribute['option'].'='.$attribute['value']; } if (strlen($title) > 250) $title = substr($title,0,250).'...'; } $productinfo = $this->getProductInfo($product_id); $weight = $productinfo['products_weight']; $width = 0; //$this->convertSize($product->width); $height = 0; //$this->convertSize($product->height); $length = 0; //$this->convertSize($product->length); $item_url = zen_catalog_href_link('product_info', "&products_id=".$product_id); //'??'; //get_permalink($product_id); $category_name = zen_get_categories_name_from_product($product_id); $picture_url = HTTP_SERVER.DIR_WS_CATALOG.DIR_WS_IMAGES.zen_get_products_image($product_id); $items = array( 'quantity' => $quantity, 'category_name' => $category_name, 'picture_url' => $picture_url, 'item_id' => $item_id, 'price' => $price, 'item_url' => $item_url, 'title' => $title ); $shipments_datas['contentvalue'] += $price*$quantity; $shipments_datas['additional_data']['items'][] = $items; $shipments_datas['content'] .= $quantity.' '.$title.'; '; for ($i = 1; $i <= $quantity; $i++) { $package = array( 'weight' => $this->convertWeight($weight), 'width' => $this->convertSize($width), 'height' => $this->convertSize($height), 'length' => $this->convertSize($length), ); $shipments_datas['additional_data']['items'][$cmpt]['package'][] = $package; // ajout des info si 1 seul produit if ($num_items==1) { $shipments_datas['packages'][] = $package; } } $cmpt++; } return $shipments_datas; } private function convertSize($size) { $ratio = $this->setting_size_rate; $size = $size * $ratio; return $size; } private function convertWeight($weight) { $ratio = $this->setting_weight_rate; $weight = $weight * $ratio; return $weight; } } xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx irgendwie ist die PHP Quelle der Fehler desweiteren bekomme ich die 39% MwSt nicht weg, obwohl als Normale Steuer die 19% eingetragen sind brauch dringend hilfe, da der shop so nicht vertretbar ist |
Beta Was this translation helpful? Give feedback.
-
Hi @3dstc, thanks for participating! We take our Code of Conduct very seriously and want to help ensure that everyone has a good experience free of antagonism and harassment. Unfortunately, we don’t currently have moderators for languages other than English. Until that changes, we need to ask that everyone use English here in the GitHub Community when posting. We’ll be locking any posts in languages other than English for now, including this one. |
Beta Was this translation helpful? Give feedback.
wo finde ich den, bin absoluter anfänger in der tippbranche,habe den shop neu installiert, alle mwst eingetragen und in den artikel normale mwst eingetragen, nun habe ich bereits in der ansicht der artikel im shop 39MwSt ??, ich habe ausser das packlink (zeigt auch Fehler im log) und den shopvote keine weiteren plugins installiert