if (!empty($product['products_name'])) {
                        $return_data['products'][$ctr]['name'] = $product['products_name'];
                        $return_data['products'][$ctr]['link'] = mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=edit_product&pid=' . $rs['products_id'] . '&cid=' . $product['categories_id'] . '&action=edit_product');
                        $ctr++;
                    } else {
                        $have_entries_in_pa_table = true;
                        $total_product--;
                    }
                }
            }
            if (!$total_product && $have_entries_in_pa_table) {
                $this->get['force_delete'] = 1;
            }
            if (isset($this->get['force_delete']) && $this->get['force_delete'] == 1) {
                //if (!$total_product) {
                $str = "delete from tx_multishop_products_attributes where options_id = " . $option_id . " and options_values_id = " . $option_value_id;
                $GLOBALS['TYPO3_DB']->sql_query($str);
                //}
                $str = "delete from tx_multishop_products_options_values_to_products_options where products_options_id = " . $option_id . " and products_options_values_id = " . $option_value_id;
                $GLOBALS['TYPO3_DB']->sql_query($str);
                $return_data['delete_status'] = 'ok';
                $return_data['delete_id'] = '.option_values_' . $option_id . '_' . $option_value_id;
            }
            $return_data['products_used'] = $total_product;
        }
        $json_data = mslib_befe::array2json($return_data);
        echo $json_data;
        exit;
        break;
}
exit;
Exemplo n.º 2
0
             } else {
                 $erno_str = '<div class="erno_message well text-danger"><ul>' . implode("\n", $erno) . '</ul></div>';
                 $return_data['status'] = 'NOTOK';
                 $return_data['reason'] = $erno_str;
             }
             echo json_encode($return_data);
             exit;
         }
     }
     exit;
     break;
 case 'update_multishop':
     if ($this->ADMIN_USER) {
         $item = array();
         $item['html'] = mslib_befe::RunMultishopUpdate();
         $json = mslib_befe::array2json($item);
         echo $json;
     }
     exit;
     break;
 case 'admin_panel_ajax_search':
     if ($this->ADMIN_USER) {
         require \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/ajax_pages/admin_panel_ajax_search.php';
     }
     exit;
     break;
 case 'ajax_products_search':
     require \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/ajax_pages/ajax_products_search.php';
     exit;
     break;
 case 'ajax_attributes_option_value_search':
Exemplo n.º 3
0
 public function getAddressInfo($type = 'shop', $customer_id = 0)
 {
     if ($this->conf['cacheConfiguration']) {
         $CACHE_FRONT_END = 1;
     } else {
         $CACHE_FRONT_END = 0;
     }
     if ($CACHE_FRONT_END) {
         $this->cacheLifeTime = 2592000;
         $options = array('caching' => true, 'cacheDir' => $this->DOCUMENT_ROOT . 'uploads/tx_multishop/tmp/cache/', 'lifeTime' => $this->cacheLifeTime);
         $Cache_Lite = new Cache_Lite($options);
         $string = $this->cObj->data['uid'] . '_ADDRESS_' . $type . '_' . $customer_id . '_' . $this->conf['tt_address_record_id_store'] . '_' . $this->conf['fe_customer_pid'];
     }
     if (!$CACHE_FRONT_END or $CACHE_FRONT_END and !($data = $Cache_Lite->get($string))) {
         if ($type == 'shop') {
             $sql_tt_address = "select *, tta.uid as tt_uid, sc.cn_iso_nr from tt_address tta, static_countries sc where tta.deleted=0 and tta.hidden=0 and tta.uid='" . addslashes($this->conf['tt_address_record_id_store']) . "' and tta.country=sc.cn_short_en";
             $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address);
             if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_tt_address) > 0) {
                 $data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_tt_address);
             } else {
                 if ($this->ADMIN_USER) {
                     echo '<h1>Admin Error Message</h1>';
                     $sql_tt_address = "select * from tt_address where uid='" . addslashes($this->conf['tt_address_record_id_store']) . "'";
                     $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address);
                     if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_tt_address) > 0) {
                         // tt_address record has been found, but the country field does not contain a valid english country name
                         echo 'System could fetch the store tt address record, but it contains an invalid country name (that is not found in static_countries table). Make sure you define the country field in tt address record in English. I.e. Netherlands, Germany, Austria etc.';
                         exit;
                     }
                     echo 'System could not fetch the store tt address record id. Maybe the value of tt_address_record_id_store is incorrect?<br />Query: ' . $sql_tt_address;
                     $sql_tt_address = "select * from tt_address where deleted=0 and hidden=0 and tx_multishop_address_type='store' and tx_multishop_customer_id=0 and page_uid='" . $this->showCatalogFromPage . "' and pid='" . $this->conf['fe_customer_pid'] . "'";
                     $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address);
                     if (!$GLOBALS['TYPO3_DB']->sql_num_rows($qry_tt_address) > 0) {
                         $item = array();
                         $item['html'] = mslib_befe::RunMultishopUpdate();
                         $json = mslib_befe::array2json($item);
                     }
                     $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address);
                     if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry_tt_address) > 0) {
                         $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address);
                         $row_tt_address = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_tt_address);
                         $recordId = $row_tt_address['uid'];
                         echo '<br /><br />Add the following line to your TYPO3 template (constants field):<br />plugin.multishop.tt_address_record_id_store=' . $recordId;
                     }
                     exit;
                 } else {
                     // old fallback mode to bypass bugs
                     $sql_tt_address = "select * from tt_address where deleted=0 and hidden=0 and tx_multishop_address_type='store' and tx_multishop_customer_id=0 and page_uid='" . $this->showCatalogFromPage . "' and pid='" . $this->conf['fe_customer_pid'] . "'";
                     $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address);
                     $data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_tt_address);
                 }
             }
         } elseif ($type == 'customer') {
             // Use wider query to prevent migration bugs
             $sql_tt_address = "select * from tt_address where deleted=0 and hidden=0 and tx_multishop_customer_id=" . $customer_id . "";
             //$sql_tt_address="select * from tt_address where deleted=0 and hidden=0 and tx_multishop_customer_id=".$customer_id." and page_uid='".$this->showCatalogFromPage."' and pid='".$this->conf['fe_customer_pid']."'";
             $qry_tt_address = $GLOBALS['TYPO3_DB']->sql_query($sql_tt_address);
             while ($row_tt_address = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_tt_address)) {
                 if ($row_tt_address['tx_multishop_default'] == 1) {
                     $data['default'] = $row_tt_address;
                 } else {
                     $data['delivery'][] = $row_tt_address;
                 }
             }
         }
         if ($CACHE_FRONT_END) {
             $Cache_Lite->save(serialize($data));
         }
         return $data;
     } else {
         return unserialize($data);
     }
     return false;
 }