コード例 #1
0
    function display($tpl = null)
    {
        $filter = JRequest::getVar('q', JRequest::getVar('term', false));
        $id = JRequest::getInt('id', false);
        $virtuemart_product_id = JRequest::getVar('virtuemart_product_id', array(), '', 'array');
        if (is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0) {
            $product_id = (int) $virtuemart_product_id[0];
        } else {
            $product_id = (int) $virtuemart_product_id;
        }
        //$customfield = $this->model->getcustomfield();
        /* Get the task */
        if ($this->type == 'relatedproducts') {
            $query = "SELECT virtuemart_product_id AS id, CONCAT(product_name, '::', product_sku) AS value\n\t\t\t\tFROM #__virtuemart_products_" . VMLANG . "\n\t\t\t\t JOIN `#__virtuemart_products` AS p using (`virtuemart_product_id`)";
            if ($filter) {
                $query .= " WHERE product_name LIKE '%" . $this->db->getEscaped($filter, true) . "%' or product_sku LIKE '%" . $this->db->getEscaped($filter, true) . "%' limit 0,10";
            }
            self::setRelatedHtml($query, 'R');
        } else {
            if ($this->type == 'relatedcategories') {
                $query = "SELECT virtuemart_category_id AS id, CONCAT(category_name, '::', virtuemart_category_id) AS value\n\t\t\t\tFROM #__virtuemart_categories_" . VMLANG;
                if ($filter) {
                    $query .= " WHERE category_name LIKE '%" . $this->db->getEscaped($filter, true) . "%' limit 0,10";
                }
                self::setRelatedHtml($query, 'Z');
            } else {
                if ($this->type == 'custom') {
                    $query = "SELECT CONCAT(virtuemart_custom_id, '|', custom_value, '|', field_type) AS id, CONCAT(custom_title, '::', custom_tip) AS value\n\t\t\t\tFROM #__virtuemart_customs";
                    if ($filter) {
                        $query .= " WHERE custom_title LIKE '%" . $filter . "%' limit 0,50";
                    }
                    $this->db->setQuery($query);
                    $this->json['value'] = $this->db->loadObjectList();
                    $this->json['ok'] = 1;
                } else {
                    if ($this->type == 'fields') {
                        $fieldTypes = $this->model->getField_types();
                        $query = "SELECT *,custom_value as value FROM #__virtuemart_customs\n\t\t\tWHERE (`virtuemart_custom_id`=" . $id . " or `custom_parent_id`=" . $id . ")";
                        $query .= " order by custom_parent_id asc";
                        $this->db->setQuery($query);
                        $rows = $this->db->loadObjectlist();
                        $html = array();
                        foreach ($rows as $field) {
                            if ($field->field_type == 'C') {
                                $this->json['table'] = 'childs';
                                $q = 'SELECT `virtuemart_product_id` FROM `#__virtuemart_products` WHERE `published`=1
					AND `product_parent_id`= ' . JRequest::getInt('virtuemart_product_id');
                                //$this->db->setQuery(' SELECT virtuemart_product_id, product_name FROM `#__virtuemart_products` WHERE `product_parent_id` ='.(int)$product_id);
                                $this->db->setQuery($q);
                                if ($childIds = $this->db->loadResultArray()) {
                                    // Get childs
                                    foreach ($childIds as $childId) {
                                        $field->custom_value = $childId;
                                        $display = $this->model->displayProductCustomfieldBE($field, $childId, $this->row);
                                        if ($field->is_cart_attribute) {
                                            $cartIcone = 'default';
                                        } else {
                                            $cartIcone = 'default-off';
                                        }
                                        $html[] = '<div class="removable">
								<td>' . $field->custom_title . '</td>
								 <td>' . $display . $field->custom_tip . '</td>
								 <td>' . JText::_($fieldTypes[$field->field_type]) . '
								' . $this->model->setEditCustomHidden($field, $this->row) . '
								 </td>
								 <td><span class="vmicon vmicon-16-' . $cartIcone . '"></span></td>
								 <td></td>
								</div>';
                                        $this->row++;
                                    }
                                }
                            } elseif ($field->field_type == 'E') {
                                $this->json['table'] = 'customPlugins';
                                $display = $this->model->displayProductCustomfieldBE($field, $product_id, $this->row);
                                if ($field->is_cart_attribute) {
                                    $cartIcone = 'default';
                                } else {
                                    $cartIcone = 'default-off';
                                }
                                $html[] = '
					<tr class="removable">
						<td><span class="hasTip" title="' . JText::_($field->custom_tip) . '">' . $field->custom_title . '</td>
						<td>' . $display . '
						' . $this->model->setEditCustomHidden($field, $this->row) . '
						<p>' . JTEXT::_('COM_VIRTUEMART_CUSTOM_ACTIVATE_JAVASCRIPT') . '</p></td>
						<td><span class="vmicon vmicon-16-' . $cartIcone . '"></span>' . JText::_('COM_VIRTUEMART_CUSTOM_EXTENSION') . '</td>
						<td><span class="vmicon vmicon-16-move"></span>
						<span class="vmicon vmicon-16-remove"></span><input class="ordering" type="hidden" value="' . $this->row . '" name="field[' . $this->row . '][ordering]" />
						</td>

					</tr>';
                                $this->row++;
                            } else {
                                $this->json['table'] = 'fields';
                                $display = $this->model->displayProductCustomfieldBE($field, $product_id, $this->row);
                                if ($field->is_cart_attribute) {
                                    $cartIcone = 'default';
                                } else {
                                    $cartIcone = 'default-off';
                                }
                                $html[] = '<tr class="removable">
						<td><span class="hasTip" title="' . JText::_($field->custom_tip) . '">' . $field->custom_title . '</td>
						 <td>' . $display . '</td>
						 <td><span class="vmicon vmicon-16-' . $cartIcone . '"></span>' . JText::_($fieldTypes[$field->field_type]) . '
							' . $this->model->setEditCustomHidden($field, $this->row) . '
						</td>
						 <td><span class="vmicon vmicon-16-move"></span><span class="vmicon vmicon-16-remove"></span><input class="ordering" type="hidden" value="' . $this->row . '" name="field[' . $this->row . '][ordering]" /></td>
						</tr>';
                                $this->row++;
                            }
                        }
                        $this->json['value'] = $html;
                        $this->json['ok'] = 1;
                    } else {
                        if ($this->type == 'userlist') {
                            $status = JRequest::getvar('status');
                            $productShoppers = 0;
                            if ($status) {
                                $productModel = VmModel::getModel('product');
                                $productShoppers = $productModel->getProductShoppersByStatus($product_id, $status);
                            }
                            if (!class_exists('ShopFunctions')) {
                                require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
                            }
                            $html = ShopFunctions::renderProductShopperList($productShoppers);
                            $this->json['value'] = $html;
                        } else {
                            $this->json['ok'] = 0;
                        }
                    }
                }
            }
        }
        if (empty($this->json)) {
            $this->json['value'] = null;
            $this->json['ok'] = 1;
        }
        echo json_encode($this->json);
    }
コード例 #2
0
ファイル: view.json.php プロジェクト: cuongnd/etravelservice
    function display($tpl = null)
    {
        $filter = vRequest::getVar('q', vRequest::getVar('term', false));
        $id = vRequest::getInt('id', false);
        $tsmart_product_id = vRequest::getInt('tsmart_product_id', array());
        if (is_array($tsmart_product_id) && count($tsmart_product_id) > 0) {
            $product_id = (int) $tsmart_product_id[0];
        } else {
            $product_id = (int) $tsmart_product_id;
        }
        //$customfield = $this->model->getcustomfield();
        /* Get the task */
        if ($this->type == 'relatedproducts') {
            $query = "SELECT tsmart_product_id AS id, CONCAT(product_name, '::', product_sku) AS value\n\t\t\t\tFROM #__tsmart_products_" . tsmConfig::$vmlang . "\n\t\t\t\t JOIN `#__tsmart_products` AS p using (`tsmart_product_id`)";
            if ($filter) {
                $query .= " WHERE product_name LIKE '%" . $this->db->escape($filter, true) . "%' or product_sku LIKE '%" . $this->db->escape($filter, true) . "%' limit 0,10";
            }
            self::setRelatedHtml($product_id, $query, 'R');
        } else {
            if ($this->type == 'relatedcategories') {
                $query = "SELECT tsmart_category_id AS id, CONCAT(category_name, '::', tsmart_category_id) AS value\n\t\t\t\tFROM #__tsmart_categories_" . tsmConfig::$vmlang;
                if ($filter) {
                    $query .= " WHERE category_name LIKE '%" . $this->db->escape($filter, true) . "%' limit 0,10";
                }
                self::setRelatedHtml($product_id, $query, 'Z');
            } else {
                if ($this->type == 'custom') {
                    $query = "SELECT CONCAT(tsmart_custom_id, '|', custom_value, '|', field_type) AS id, CONCAT(custom_title, '::', custom_tip) AS value\n\t\t\t\tFROM #__tsmart_customs";
                    if ($filter) {
                        $query .= " WHERE custom_title LIKE '%" . $filter . "%' limit 0,50";
                    }
                    $this->db->setQuery($query);
                    $this->json['value'] = $this->db->loadObjectList();
                    $this->json['ok'] = 1;
                } else {
                    if ($this->type == 'fields') {
                        if (!class_exists('tsmartModelCustom')) {
                            require VMPATH_ADMIN . DS . 'models' . DS . 'custom.php';
                        }
                        $fieldTypes = tsmartModelCustom::getCustomTypes();
                        $model = tmsModel::getModel('custom');
                        $q = 'SELECT `tsmart_custom_id` FROM `#__tsmart_customs`
			WHERE (`custom_parent_id`=' . $id . ') ';
                        $q .= 'order by `ordering` asc';
                        $this->db->setQuery($q);
                        $ids = $this->db->loadColumn();
                        if ($ids) {
                            array_unshift($ids, $id);
                        } else {
                            $ids = array($id);
                        }
                        foreach ($ids as $k => $i) {
                            $p = $model->getCustom($i);
                            if ($p) {
                                $p->value = $p->custom_value;
                                $rows[] = $p;
                            }
                        }
                        $html = array();
                        foreach ($rows as $field) {
                            if ($field->field_type == 'deprecatedwasC') {
                                $this->json['table'] = 'childs';
                                $q = 'SELECT `tsmart_product_id` FROM `#__tsmart_products` WHERE `published`=1
					AND `product_parent_id`= ' . vRequest::getInt('tsmart_product_id');
                                //$this->db->setQuery(' SELECT tsmart_product_id, product_name FROM `#__tsmart_products` WHERE `product_parent_id` ='.(int)$product_id);
                                $this->db->setQuery($q);
                                if ($childIds = $this->db->loadColumn()) {
                                    // Get childs
                                    foreach ($childIds as $childId) {
                                        $field->custom_value = $childId;
                                        $display = $this->model->displayProductCustomfieldBE($field, $childId, $this->row);
                                        if ($field->is_cart_attribute) {
                                            $cartIcone = 'default';
                                        } else {
                                            $cartIcone = 'default-off';
                                        }
                                        $html[] = '<div class="removable">
								<td>' . $field->custom_title . '</td>
								 <td>' . $display . $field->custom_tip . '</td>
								 <td>' . tsmText::_($fieldTypes[$field->field_type]) . '
								' . $this->model->setEditCustomHidden($field, $this->row) . '
								 </td>
								 <td><span class="vmicon vmicon-16-' . $cartIcone . '"></span></td>
								 <td></td>
								</div>';
                                        $this->row++;
                                    }
                                }
                            } else {
                                //if ($field->field_type =='E') {
                                $this->json['table'] = 'customPlugins';
                                $colspan = '';
                                if ($field->field_type == 'E') {
                                    $this->model->bindCustomEmbeddedFieldParams($field, 'E');
                                } else {
                                    if ($field->field_type == 'C') {
                                        $colspan = 'colspan="2" ';
                                    }
                                }
                                $display = $this->model->displayProductCustomfieldBE($field, $product_id, $this->row);
                                if ($field->is_cart_attribute) {
                                    $cartIcone = 'default';
                                } else {
                                    $cartIcone = 'default-off';
                                }
                                $field->tsmart_product_id = $product_id;
                                $html[] = '
					<tr class="removable">
						<td>
							<b>' . tsmText::_($fieldTypes[$field->field_type]) . '</b> ' . tsmText::_($field->custom_title) . '</span><br/>

								<span class="vmicon vmicon-16-' . $cartIcone . '"></span>
								<span class="vmicon vmicon-16-move"></span>
								<span class="vmicon vmicon-16-remove"></span>

						' . $this->model->setEditCustomHidden($field, $this->row) . '
					 	</td>
							<td ' . $colspan . '>' . $display . '</td>
						 </tr>
					</tr>';
                                $this->row++;
                            }
                        }
                        $this->json['value'] = $html;
                        $this->json['ok'] = 1;
                    } else {
                        if ($this->type == 'userlist') {
                            $status = vRequest::getvar('status');
                            $productShoppers = 0;
                            if ($status) {
                                $productModel = tmsModel::getModel('product');
                                $productShoppers = $productModel->getProductShoppersByStatus($product_id, $status);
                            }
                            if (!class_exists('ShopFunctions')) {
                                require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
                            }
                            $html = ShopFunctions::renderProductShopperList($productShoppers);
                            $this->json['value'] = $html;
                        } else {
                            $this->json['ok'] = 0;
                        }
                    }
                }
            }
        }
        if (empty($this->json)) {
            $this->json['value'] = null;
            $this->json['ok'] = 1;
        }
        echo vmJsApi::safe_json_encode($this->json);
    }
コード例 #3
0
						<th class="title"><?php 
echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_ITEM_STATUS');
?>
</th>
						<th class="title"><?php 
echo vmText::_('COM_VIRTUEMART_ORDER_NUMBER');
?>
</th>
					</tr>
					</thead>
					<tbody id="customers-list">
					<?php 
if (!class_exists('ShopFunctions')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
}
echo ShopFunctions::renderProductShopperList($this->productShoppers);
?>
					</tbody>
				</table>
			</div>

			<div id="customer-mail-notify-list">

				<?php 
if (VmConfig::get('stockhandle', 0) == 'disableadd' && !empty($this->waitinglist)) {
    ?>
				<div style="font-weight:bold;"><?php 
    echo vmText::_('COM_VIRTUEMART_PRODUCT_WAITING_LIST_USERLIST');
    ?>
</div>
				<table class="adminlist table" cellspacing="0" cellpadding="0">
コード例 #4
0
    function display($tpl = null)
    {
        // Get the task
        $this->task = JRequest::getWord('task', $this->getLayout());
        if ($this->task == 'massxref_cats_exe') {
            return;
        }
        $filter = JRequest::getVar('q', JRequest::getVar('term', false));
        if ($filter) {
            $filter = $this->db->escape($filter, true);
        }
        $id = JRequest::getInt('id', false);
        $product_id = JRequest::getInt('virtuemart_product_id', 0);
        //$customfield = $this->model->getcustomfield();
        /* Get the task */
        if ($this->type == 'relatedproducts') {
            $query = "SELECT virtuemart_product_id AS id, CONCAT(product_name, '::', product_sku) AS value\n\t\t\t\tFROM #__virtuemart_products_" . VMLANG . "\n\t\t\t\t JOIN `#__virtuemart_products` AS p using (`virtuemart_product_id`)";
            if ($filter) {
                $query .= " WHERE product_name LIKE '%" . $filter . "%' or product_sku LIKE '%" . $filter . "%'";
            }
            $query .= " limit 0,10";
            if (JRequest::getInt('kit', 0)) {
                $fieldType = "K";
            } else {
                $fieldType = "R";
            }
            self::setRelatedHtml($query, $fieldType);
        } else {
            if ($this->type == 'relatedcategories') {
                $query = "SELECT virtuemart_category_id AS id, CONCAT(category_name, '::', virtuemart_category_id) AS value\n\t\t\t\tFROM #__virtuemart_categories_" . VMLANG;
                if ($filter) {
                    $query .= " WHERE category_name LIKE '%" . $filter . "%'";
                }
                $query .= " limit 0,10";
                self::setRelatedHtml($query, 'Z');
            } else {
                if ($this->type == 'custom') {
                    $query = "SELECT CONCAT(virtuemart_custom_id, '|', custom_value, '|', field_type) AS id, CONCAT(custom_title, '::', custom_tip) AS value\n\t\t\t\tFROM #__virtuemart_customs";
                    if ($filter) {
                        $query .= " WHERE custom_title LIKE '%" . $filter . "%' limit 0,50";
                    }
                    $this->db->setQuery($query);
                    $this->json['value'] = $this->db->loadObjectList();
                    $this->json['ok'] = 1;
                } else {
                    if ($this->type == 'fields') {
                        $fieldTypes = $this->model->getField_types();
                        $query = "SELECT *,custom_value as value FROM #__virtuemart_customs\n\t\t\tWHERE (`virtuemart_custom_id`=" . $id . " or `custom_parent_id`=" . $id . ")";
                        $query .= " order by custom_parent_id asc";
                        $this->db->setQuery($query);
                        $rows = $this->db->loadObjectlist();
                        $html = array('cart_attributes' => '', 'custom_fields' => '', 'childs' => '');
                        foreach ($rows as $field) {
                            if ($field->field_type == 'C') {
                                $this->json['table'] = 'childs';
                                $q = 'SELECT `virtuemart_product_id` FROM `#__virtuemart_products` WHERE `published`=1
					AND `product_parent_id`= ' . JRequest::getInt('virtuemart_product_id');
                                //$this->db->setQuery(' SELECT virtuemart_product_id, product_name FROM `#__virtuemart_products` WHERE `product_parent_id` ='.(int)$product_id);
                                $this->db->setQuery($q);
                                if ($childIds = $this->db->loadColumn()) {
                                    // Get childs
                                    foreach ($childIds as $childId) {
                                        $field->custom_value = $childId;
                                        $display = $this->model->displayProductCustomfieldBE($field, $childId, $this->row);
                                        if ($field->is_cart_attribute) {
                                            $cartIcone = 'default';
                                        } else {
                                            $cartIcone = 'default-off';
                                        }
                                        $html[] = '<div class="removable">
								<td>' . $field->custom_title . '</td>
								 <td>' . $display . $field->custom_tip . '</td>
								 <td>' . JText::_($fieldTypes[$field->field_type]) . '
								' . $this->model->setEditCustomHidden($field, $this->row) . '
								 </td>
								 <td><span class="vmicon vmicon-16-' . $cartIcone . '"></span></td>
								 <td></td>
								</div>';
                                        $this->row++;
                                    }
                                }
                            } else {
                                $this->json['table'] = 'fields';
                                $display = $this->model->displayProductCustomfieldBE($field, $product_id, $this->row);
                                if ($field->custom_tip) {
                                    $tip = ' class="hasTooltip" title="' . $field->custom_tip . '"';
                                } else {
                                    $tip = '';
                                }
                                if ($field->layout_pos) {
                                    $field->layout_pos = '<div><small>' . $field->layout_pos . '</small></div>';
                                }
                                $tbName = $field->is_cart_attribute ? 'cart_attributes' : 'custom_fields';
                                $html[$tbName] .= '<tr class="removable">
						<td class="hidden-phone"><span class="icon-menu"></span>
							<input class="ordering" type="hidden" value="' . $this->row . '" name="field[' . $this->row . '][ordering]" />
						</td>
						<td><div ' . $tip . '>' . JText::_($field->custom_title) . '<div>' . ($field->custom_field_desc ? '<small>' . $field->custom_field_desc . '</small>' : '') . '
						 <td>' . $display . '</td>
						 <td>
							' . JText::_($fieldTypes[$field->field_type]) . '
							' . $field->layout_pos . '
							' . $this->model->setEditCustomHidden($field, $this->row) . '
						</td>
						 <td><span class="icon-remove"></span></td>
					</tr>';
                                $this->row++;
                            }
                        }
                        foreach ($html as $key => $item) {
                            if (empty($item)) {
                                unset($html[$key]);
                            }
                        }
                        $this->json['value'] = $html;
                        $this->json['ok'] = 1;
                    } else {
                        if ($this->type == 'userlist') {
                            $status = JRequest::getvar('status');
                            $productShoppers = 0;
                            if ($status) {
                                $productModel = VmModel::getModel('product');
                                $productShoppers = $productModel->getProductShoppersByStatus($product_id, $status);
                            }
                            JLoader::register('ShopFunctions', JPATH_VM_ADMINISTRATOR . 'helpers/shopfunctions.php');
                            $html = ShopFunctions::renderProductShopperList($productShoppers);
                            $this->json['value'] = $html;
                        } else {
                            $this->json['ok'] = 0;
                        }
                    }
                }
            }
        }
        if (empty($this->json)) {
            $this->json['value'] = null;
            $this->json['ok'] = 1;
        }
        echo json_encode($this->json);
    }