public static function formData($id = null, $parent = null) { global $lC_Language, $_module; $lC_Language->loadIniFile('categories.php'); $lC_CategoryTree = new lC_CategoryTree_Admin(); $result = array(); $categories_array = array('0' => $lC_Language->get('top_category')); foreach ($lC_CategoryTree->getArray() as $value) { $cid = explode('_', $value['id']); $count = count($cid); $cid = end($cid); $acArr = lC_Categories_Admin::getAllChildren($id); if ($cid != $id && !lC_Categories_Admin::in_array_r($cid, $acArr)) { $categories_array[$cid] = str_repeat(" ", $count - 1) . ' ' . $value['title']; } } $result['categoriesArray'] = $categories_array; if (isset($id) && is_numeric($id)) { $result['cData'] = lC_Categories_Admin::get($id, $lC_Language->getID()); $result['categoryImage'] = ''; $lC_ObjectInfo = new lC_ObjectInfo(lC_Categories_Admin::get($id)); if (!lc_empty($lC_ObjectInfo->get('categories_image'))) { $result['categoryImage'] = '<div><p>' . lc_image('../' . DIR_WS_IMAGES . 'categories/' . $lC_ObjectInfo->get('categories_image'), $lC_ObjectInfo->get('categories_name'), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '<br />' . DIR_WS_CATALOG . 'images/categories/' . $lC_ObjectInfo->getProtected('categories_image') . '</p></div>'; } } $category_names = ''; foreach ($lC_Language->getAll() as $l) { if (isset($id) && is_numeric($id)) { $category_names .= '<span class="input" style="width:88%"><label for="categories_name[' . $l['id'] . ']" class="button silver-gradient glossy">' . $lC_Language->showImage($l['code']) . '</label>' . lc_draw_input_field('categories_name[' . $l['id'] . ']', $result['cData']['categories_name'], 'class="input-unstyled"') . '</span><br />'; } else { $category_names .= '<span class="input" style="width:88%"><label for="categories_name[' . $l['id'] . ']" class="button silver-gradient glossy">' . $lC_Language->showImage($l['code']) . '</label>' . lc_draw_input_field('categories_name[' . $l['id'] . ']', null, 'class="input-unstyled"') . '</span><br />'; } } $result['categoryNames'] = $category_names; $result['parentCategory'] = isset($parent) && $parent != null ? $parent : 0; return $result; }
$Qdata->bindValue(':code', 'date_available'); $Qdata->bindValue(':modules_group', 'product_attributes'); $Qdata->execute(); $lC_ObjectInfo->set('products_date_available', $Qdata->value('products_date_available')); ?> <h1><?php echo lc_link_object(lc_href_link_admin(FILENAME_DEFAULT, $lC_Template->getModule()), $lC_Template->getPageTitle()); ?> </h1> <?php if ($lC_MessageStack->exists($lC_Template->getModule())) { echo $lC_MessageStack->get($lC_Template->getModule()); } ?> <div class="infoBoxHeading"><?php echo lc_icon_admin('edit.png') . ' ' . $lC_ObjectInfo->getProtected('products_name'); ?> </div> <div class="infoBoxContent"> <form name="pEdit" action="<?php echo lc_href_link_admin(FILENAME_DEFAULT, $lC_Template->getModule() . '&page=' . $_GET['page'] . '&pID=' . $lC_ObjectInfo->getInt('products_id') . '&action=save'); ?> " method="post"> <p><?php echo $lC_Language->get('introduction_edit_product_expected'); ?> </p> <p><?php echo $lC_Language->get('field_date_expected') . '<br />' . lc_draw_input_field('products_date_available', $lC_ObjectInfo->get('products_date_available')); ?> </p>
public static function preview($id) { global $lC_Database, $lC_Language, $lC_Currencies; $lC_Image = new lC_Image_Admin(); $lC_Language->loadIniFile('products.php'); $result = array(); $Qp = $lC_Database->query('select p.products_id, p.products_quantity, p.products_cost, p.products_price, p.products_msrp, p.products_model, p.products_sku, p.products_weight, p.products_weight_class, p.products_date_added, p.products_last_modified, p.products_status, p.products_tax_class_id, p.manufacturers_id, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and default_flag = :default_flag) where p.products_id = :products_id'); $Qp->bindTable(':table_products', TABLE_PRODUCTS); $Qp->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES); $Qp->bindInt(':products_id', $id); $Qp->bindInt(':default_flag', 1); $Qp->execute(); $Qpd = $lC_Database->query('select products_name, products_blurb, products_description, products_url, language_id from :table_products_description where products_id = :products_id'); $Qpd->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION); $Qpd->bindInt(':products_id', $id); $Qpd->execute(); $pd_extra = array(); while ($Qpd->next()) { $pd_extra['products_name'][$Qpd->valueInt('language_id')] = $Qpd->valueProtected('products_name'); $pd_extra['products_blurb'][$Qpd->valueInt('language_id')] = $Qpd->valueProtected('products_blurb'); $pd_extra['products_description'][$Qpd->valueInt('language_id')] = $Qpd->value('products_description'); $pd_extra['products_url'][$Qpd->valueInt('language_id')] = $Qpd->valueProtected('products_url'); } $lC_ObjectInfo = new lC_ObjectInfo(array_merge($Qp->toArray(), $pd_extra)); $products_name = $lC_ObjectInfo->get('products_name'); $products_blurb = $lC_ObjectInfo->get('products_blurb'); $products_description = $lC_ObjectInfo->get('products_description'); $products_url = $lC_ObjectInfo->get('products_url'); $result['previewHtml'] = '<div>'; foreach ($lC_Language->getAll() as $l) { $result['previewHtml'] .= '<span id="lang_' . $l['code'] . '"' . ($l['code'] == $lC_Language->getCode() ? ' class="highlight"' : '') . '><a href="javascript:toggleDivBlocks(\'pName_\', \'pName_' . $l['code'] . '\'); toggleClass(\'lang_\', \'lang_' . $l['code'] . '\', \'highlight\', \'span\');">' . $lC_Language->showImage($l['code']) . '</a></span> '; } $result['previewHtml'] .= '</div>'; foreach ($lC_Language->getAll() as $l) { $result['previewHtml'] .= '<div id="pName_' . $l['code'] . '" ' . ($l['code'] != $lC_Language->getCode() ? ' style="display: none;"' : '') . '>'; $result['previewHtml'] .= ' <table border="0" width="100%" cellspacing="0" cellpadding="2">'; $result['previewHtml'] .= ' <tr>'; $result['previewHtml'] .= ' <td><h1>' . lc_output_string_protected($products_name[$l['id']]) . (!lc_empty($lC_ObjectInfo->get('products_model')) ? '<br /><span>' . $lC_ObjectInfo->getProtected('products_model') . '</span>' : '') . '</h1></td>'; $result['previewHtml'] .= ' <td align="right"><h1>' . $lC_Currencies->format($lC_ObjectInfo->get('products_price')) . '</h1></td>'; $result['previewHtml'] .= ' </tr>'; $result['previewHtml'] .= ' </table>'; $result['previewHtml'] .= ' <p>' . $lC_Image->show($lC_ObjectInfo->get('image'), $products_name[$l['id']], 'align="right" hspace="5" vspace="5"', 'product_info') . $products_description[$l['id']] . '</p>'; if (!empty($products_url[$l['id']])) { $result['previewHtml'] .= '<p>' . sprintf($lC_Language->get('text_more_product_information'), lc_output_string_protected($products_url[$l['id']])) . '</p>'; } $result['previewHtml'] .= '<p align="center">' . sprintf($lC_Language->get('text_product_date_added'), lC_DateTime::getLong($lC_ObjectInfo->get('products_date_added'))) . '</p>'; $result['previewHtml'] .= '</div>'; } return $result; }