Example #1
0
 /**
  * Formate les valeurs principales d'un élément suivant la ligne passées en paramètre
  * @param $row
  * @param $current
  * @return array|null
  */
 public function setItemData($row, $current)
 {
     $ModelImagepath = new magixglobal_model_imagepath();
     $ModelDateformat = new magixglobal_model_dateformat();
     $ModelTemplate = new frontend_model_template();
     $ModelRewrite = new magixglobal_model_rewrite();
     $data = null;
     if (isset($row['idnews'])) {
         $data['tag'] = null;
         $tag['data'] = parent::s_tagByNews($row['idnews']);
         if (is_array($tag['data'])) {
             foreach ($tag['data'] as $t) {
                 $t['uri'] = $ModelRewrite->filter_news_tag_url($row['iso'], $t['name_tag'], true);
                 $data['tag'] .= '<a href="' . $t['uri'] . '" title="' . $t['name_tag'] . '">';
                 $data['tag'] .= $t['name_tag'];
                 $data['tag'] .= '</a> ';
             }
         }
         if (isset($row['n_image'])) {
             $data['imgSrc'] = array('small' => $ModelImagepath->filterPathImg(array('filtermod' => 'news', 'img' => 's_' . $row['n_image'])), 'medium' => $ModelImagepath->filterPathImg(array('filtermod' => 'news', 'img' => $row['n_image'])));
         }
         $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/news/news-default.png'));
         $data['id'] = $row['idnews'];
         $data['name'] = $row['n_title'];
         $data['uri'] = $ModelRewrite->filter_news_url($row['iso'], $ModelDateformat->date_europeen_format($row['date_register']), $row['n_uri'], $row['keynews'], true);
         $data['current'] = false;
         if (isset($current['record']['id'])) {
             $data['active'] = $row['keynews'] == $current['record']['id'] ? true : false;
         }
         $data['date']['register'] = $ModelDateformat->SQLDate($row['date_register']);
         $data['date']['publish'] = $ModelDateformat->SQLDate($row['date_publish']);
         $data['content'] = $row['n_content'];
     }
     return $data;
 }
Example #2
0
 /**
  * Formate les valeurs principales d'un élément suivant la ligne passées en paramètre
  * @param $row
  * @param $current
  * @return array|null
  */
 public function setItemData($row, $current)
 {
     $ModelRewrite = new magixglobal_model_rewrite();
     $data = null;
     if ($row != null) {
         $data['id'] = $row['idpage'];
         $data['name'] = $row['title_page'];
         $data['url'] = $row['idcat_p'] != 0 ? $ModelRewrite->filter_cms_url($row['iso'], $row['idcat_p'], $row['uri_page_p'], $row['idpage'], $row['uri_page'], true) : $ModelRewrite->filter_cms_url($row['iso'], null, null, $row['idpage'], $row['uri_page'], true);
         $data['active'] = false;
         if ($row['idpage'] == $current['record']['id'] or $row['idpage'] == $current['parent']['id']) {
             $data['active'] = true;
         }
         $data['content'] = $row['content_page'];
         $data['date']['update'] = $row['last_update'];
         $data['date']['register'] = $row['date_register'];
         return $data;
     }
 }
/**
 * Smarty plugin
 * @package     Smarty
 * @subpackage  plugins
 * Type:        function
 * Name:        widget_news_display
 * date:        25/12/2013
 * Update:      10/03/2013
 * Examples:    {widget_news_display}
 * @author      Sire Sam (sire-sam.be)
 * @link        htt://www.sire-sam.be, http://www.magix-dev.be
 * @author      Gerits Aurelien
 * @version     1.1
 * @param       array
 * @param       Smarty
 * @return      string
 */
function smarty_function_widget_news_data($params, $template)
{
    $ModelSystem = new magixglobal_model_system();
    $ModelRewrite = new magixglobal_model_rewrite();
    $ModelNews = new frontend_model_news();
    $ModelPager = new magixglobal_model_pager();
    // Set and load data
    $current = $ModelSystem->setCurrentId();
    $conf = is_array($params['conf']) ? $params['conf'] : array();
    $override = $params['conf']['plugins']['override'] ? $params['conf']['plugins']['override'] : '';
    $data = $ModelNews->getData($conf, $current, $override);
    $newrow = is_array($params['conf']['plugins']['item']) ? $params['conf']['plugins']['item'] : array();
    // Set Pagination
    $pagination = array();
    if (isset($data['total']) and isset($data['limit'])) {
        $pagination = $ModelPager->setPaginationData($data['total'], $data['limit'], '/' . $current['lang']['iso'] . $ModelRewrite->mod_news_lang($current['lang']['iso']), $current['news']['pagination']['id'], '/');
        unset($data['total']);
        unset($data['limit']);
    }
    $current = $current['news'];
    // Format data
    $items = array();
    if ($data != null) {
        foreach ($data as $row) {
            if (isset($row['idnews'])) {
                $items[] = $ModelNews->setItemData($row, $current, $newrow);
            } elseif (isset($row['name_tag'])) {
                $items[] = array('id' => $row['name_tag'], 'name' => $row['name_tag'], 'iso' => $row['iso'], 'url' => magixglobal_model_rewrite::filter_news_tag_url($row['iso'], urlencode($row['name_tag']), true));
            }
        }
    }
    $assign = isset($params['assign']) ? $params['assign'] : 'data';
    $template->assign($assign, $items);
    $assignPager = isset($params['assignPagination']) ? $params['assignPagination'] : 'paginationData';
    $template->assign($assignPager, $pagination);
}
Example #4
0
 /**
  * @access private
  * Rechercher une news et retourne sous forme JSON
  */
 private function json_url_news()
 {
     if ($this->news_search != '') {
         if (parent::s_search_news($this->news_search) != null) {
             foreach (parent::s_search_news($this->news_search) as $key) {
                 $dateformat = new magixglobal_model_dateformat();
                 $url_news = magixglobal_model_rewrite::filter_news_url($key['iso'], $dateformat->date_europeen_format($key['date_register']), $key['n_uri'], $key['keynews'], true);
                 $json[] = '{"idnews":' . json_encode($key['idnews']) . ',"n_title":' . json_encode($key['n_title']) . ',"iso":' . json_encode(magixcjquery_string_convert::upTextCase($key['iso'])) . ',"url_news":' . json_encode($url_news) . ',"date_register":' . json_encode($key['date_register']) . '}';
             }
             print '[' . implode(',', $json) . ']';
         }
     } else {
         print '{}';
     }
 }
Example #5
0
 /**
  * Formate les valeurs principales d'un élément suivant la ligne passées en paramètre
  * @param $row
  * @param $current
  * @return array|null
  * @todo revoir le nommage de 'current', lui préférant 'active'
  */
 public function setItemData($row, $current)
 {
     $ModelImagepath = new magixglobal_model_imagepath();
     $ModelTemplate = new frontend_model_template();
     $ModelRewrite = new magixglobal_model_rewrite();
     $data = null;
     if ($row != null) {
         // *** Product
         if (isset($row['titlecatalog'])) {
             $subcat['id'] = isset($row['idcls']) ? $row['idcls'] : null;
             $subcat['name'] = isset($row['pathslibelle']) ? $row['pathslibelle'] : null;
             if (isset($row['imgcatalog'])) {
                 $data['imgSrc'] = array('small' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'mini/' . $row['imgcatalog'], 'levelmod' => '')), 'medium' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'medium/' . $row['imgcatalog'], 'levelmod' => '')), 'large' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'product/' . $row['imgcatalog'], 'levelmod' => '')));
             }
             $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/product-default.png'));
             $data['url'] = $ModelRewrite->filter_catalog_product_url($row['iso'], $row['pathclibelle'], $row['idclc'], $subcat['name'], $subcat['id'], $row['urlcatalog'], $row['idproduct'], true);
             $data['active'] = false;
             if (is_array($current)) {
                 $data['active'] = (isset($current['product']['id']) and $current['product']['id'] == $row['idproduct']) ? true : false;
             } elseif ($current === true) {
                 $data['active'] = true;
             }
             $data['id'] = $row['idproduct'];
             $data['name'] = $row['titlecatalog'];
             $data['price'] = $row['price'];
             $data['content'] = $row['desccatalog'];
             // *** Subcategory
         } elseif (isset($row['slibelle'])) {
             $data['active'] = false;
             if (is_array($current) and isset($current['subcategory']['id'])) {
                 $data['active'] = $current['subcategory']['id'] == $row['idcls'] ? true : false;
             }
             if (isset($row['img_s'])) {
                 $data['imgSrc'] = array();
                 $data['imgSrc']['small'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => $row['img_s'], 'levelmod' => 'subcategory'));
                 $data['imgSrc']['medium'] = $data['imgSrc']['small'];
                 $data['imgSrc']['large'] = $data['imgSrc']['small'];
             }
             $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/subcategory-default.png'));
             $data['url'] = $ModelRewrite->filter_catalog_subcategory_url($row['iso'], $row['pathclibelle'], $row['idclc'], $row['pathslibelle'], $row['idcls'], true);
             $data['id'] = $row['idcls'];
             $data['name'] = $row['slibelle'];
             $data['content'] = $row['s_content'] != '' ? $row['s_content'] : null;
             // *** Category
         } elseif (isset($row['clibelle'])) {
             $data['active'] = false;
             if (is_array($current) and isset($current['category']['id'])) {
                 $data['active'] = $current['category']['id'] == $row['idclc'] ? true : false;
             }
             if (isset($row['img_c'])) {
                 $data['imgSrc'] = array();
                 $data['imgSrc']['small'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => $row['img_c'], 'levelmod' => 'category'));
                 // I know it's like cheat
                 $data['imgSrc']['medium'] = $data['imgSrc']['small'];
                 $data['imgSrc']['large'] = $data['imgSrc']['small'];
             }
             $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/category-default.png'));
             $data['url'] = $ModelRewrite->filter_catalog_category_url($row['iso'], $row['pathclibelle'], $row['idclc'], true);
             $data['id'] = $row['idclc'];
             $data['name'] = $row['clibelle'];
             $data['content'] = $row['c_content'] != '' ? $row['c_content'] : null;
             // *** Micro-gallery (product page)
         } elseif (isset($row['idmicro'])) {
             $data['id'] = $row['idmicro'];
             $data['img_src']['small'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'mini/' . $row['imgcatalog'], 'levelmod' => 'galery'));
             $data['img_src']['medium'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'maxi/' . $row['imgcatalog'], 'levelmod' => 'galery'));
         }
         return $data;
     }
 }
/**
 * Smarty plugin
 * @package     Smarty
 * @subpackage  plugins
 * Type:        function
 * Name:        widget_news_display
 * date:        25/12/2013
 * Update:      10/03/2013
 * Examples:    {widget_news_display}
 * @author      Sire Sam (sire-sam.be)
 * @link        htt://www.sire-sam.be, http://www.magix-dev.be
 * @author      Gerits Aurelien
 * @version     1.1
 * @param       array
 * @param       Smarty
 * @return      string
 */
function smarty_function_widget_news_display($params, $template)
{
    $ModelSystem = new magixglobal_model_system();
    $ModelRewrite = new magixglobal_model_rewrite();
    $ModelConstructor = new magixglobal_model_constructor();
    $ModelNews = new frontend_model_news();
    $ModelPager = new magixglobal_model_pager();
    $Debug = new magixcjquery_debug_magixfire();
    // Set and load data
    $current = $ModelSystem->setCurrentId();
    $conf = is_array($params['conf']) ? $params['conf'] : array();
    $data = $ModelNews->getData($conf, $current);
    // Set Pagination
    $pagination['html'] = null;
    if (isset($data['total']) and isset($data['limit'])) {
        $pagination['src'] = $ModelPager->setPaginationData($data['total'], $data['limit'], '/' . $current['lang']['iso'] . $ModelRewrite->mod_news_lang($current['lang']['iso']), $current['news']['pagination']['id'], '/');
        $pagination['html'] = $ModelConstructor->formatPaginationHtml($pagination['src'], $current['news']['pagination']['id']);
        unset($data['total']);
        unset($data['limit']);
    }
    $current = $current['news'];
    // Format data
    $html = null;
    if ($data != null) {
        $pattern['default'] = patternNews();
        $pattern['custom'] = null;
        if ($params['pattern']) {
            $pattern['custom'] = is_array($params['pattern']) ? $params['pattern'] : patternNews($params['pattern']);
        }
        $pattern['global'] = $ModelConstructor->mergeHtmlPattern($pattern['default'], $pattern['custom']);
        $i = 0;
        $items['html'] = null;
        foreach ($data as $row) {
            $i++;
            $itemData = $ModelNews->setItemData($row, $current);
            // *** set item html structure & var
            $pattern['global']['is_active'] = $itemData['active'] === true ? 1 : 0;
            $pattern['global']['id'] = isset($itemData['id']) ? $itemData['id'] : 0;
            $pattern['global']['url'] = isset($itemData['uri']) ? $itemData['uri'] : '#';
            $pattern['item'] = $ModelConstructor->setItemPattern($pattern['global'], $i);
            // *** Reset iteration if item is last of the line
            if ($pattern['item']['is_last'] == 1) {
                $i = 0;
            }
            // *** in case diplay is null, we take default value
            if ($pattern['item']['display'][1] == null) {
                $pattern['item']['display'][1] = $pattern['default']['display'][1];
            }
            $imgSize = isset($pattern['item']['img']['size']) ? $pattern['item']['img']['size'] : 'small';
            if (isset($itemData['imgSrc'][$imgSize])) {
                $itemData['imgSrc'] = $itemData['imgSrc'][$imgSize];
            } else {
                $itemData['imgSrc'] = $itemData['imgSrc']['default'];
            }
            // *** format item loop (foreach element)
            $itemHtml = null;
            foreach ($pattern['item']['display'][1] as $elem_type) {
                $pattern['elem'] = $pattern['item'][$elem_type];
                if (array_search($elem_type, $pattern['item']['display'][1])) {
                    switch ($elem_type) {
                        case 'name':
                            $elem = $itemData['name'];
                            break;
                        case 'img':
                            $elem = '<img src="' . $itemData['imgSrc'] . '" alt="' . $itemData['name'] . '"/>';
                            break;
                        case 'descr':
                            $elem = magixcjquery_form_helpersforms::inputCleanTruncate(magixcjquery_form_helpersforms::inputTagClean($itemData['content']), $pattern['item']['descr']['lenght'], $pattern['item']['descr']['delemiter']);
                            break;
                        case 'date':
                            $elem = $ModelConstructor->formatDateHtml($itemData['date']['publish'], $pattern['item']);
                            break;
                        case 'tag':
                            $elem = $itemData['tag'];
                            break;
                        default:
                            $elem = null;
                    }
                    if ($elem != null or isset($pattern['elem']['before']) or isset($pattern['elem']['after'])) {
                        $itemHtml .= $pattern['elem']['before'];
                        $itemHtml .= $elem;
                        $itemHtml .= $pattern['elem']['after'];
                    }
                }
            }
            // *** item construct
            $items['html'] .= $pattern['item']['item']['before'];
            $items['html'] .= $itemHtml;
            $items['html'] .= $pattern['item']['item']['after'];
        }
        // *** container construct
        $html = isset($params['title']) ? $params['title'] : '';
        $html .= $pattern['global']['container']['before'];
        $html .= isset($params['prepend']) ? $params['prepend'] : null;
        $html .= $items['html'];
        $html .= isset($params['append']) ? $params['append'] : null;
        $html .= $pattern['global']['container']['after'];
        $html .= $pagination['html'];
    }
    return $html;
}
Example #7
0
 /**
  * @access private
  * Ecrit les urls des images du catalogue (Google Image sitemap)
  */
 private function writeImagesCatalog($idlang)
 {
     // instance la classe
     $sitemap = new magixcjquery_xml_sitemap();
     // Les images des catégories du catalogue sur la racine de celui-ci
     foreach (parent::c_catalog_category($idlang) as $data) {
         if ($data['catimg'] != 0) {
             $sitemap->writeMakeNodeImage(magixcjquery_html_helpersHtml::getUrl() . magixglobal_model_rewrite::filter_catalog_root_url($data['iso'], true), 'img_c', magixcjquery_html_helpersHtml::getUrl() . '/upload/catalogimg/category/', parent::s_catalog_category($data['idlang']));
         }
     }
     //Les images des sous catégories du catalogue de chaque catégorie
     foreach (parent::s_catalog_category($idlang) as $data) {
         $count = parent::c_catalog_subcategory($data['idclc']);
         if ($count['subcatimg'] != 0) {
             $uri_cat = magixglobal_model_rewrite::filter_catalog_category_url($data['iso'], $data['pathclibelle'], $data['idclc'], true);
             $sitemap->writeMakeNodeImage(magixcjquery_html_helpersHtml::getUrl() . $uri_cat, 'img_s', magixcjquery_html_helpersHtml::getUrl() . '/upload/catalogimg/subcategory/', parent::s_catalog_subcategory_images_by_lang($data['idclc']));
         }
     }
     // Les images des produits du catalogue
     foreach (parent::s_catalog_sitemap($idlang) as $data) {
         $uri = magixglobal_model_rewrite::filter_catalog_product_url($data['iso'], $data['pathclibelle'], $data['idclc'], $data['pathslibelle'], $data['idcls'], $data['urlcatalog'], $data['idproduct'], true);
         if ($data['imgcatalog'] != null) {
             $sitemap->writeMakeNodeImage(magixcjquery_html_helpersHtml::getUrl() . $uri, $data['imgcatalog'], magixcjquery_html_helpersHtml::getUrl() . '/upload/catalogimg/product/');
         }
     }
 }
Example #8
0
 /**
  * Création d'un noeud dans le fichier XML
  * @param $idlang
  * @param $iso
  */
 private function create_node_xml_news($idlang, $iso)
 {
     $attr_name = parent::s_config_named_data('news');
     if ($attr_name['status'] == 1) {
         foreach (parent::s_news($idlang) as $data) {
             $dateformat = new magixglobal_model_dateformat();
             $uri = magixglobal_model_rewrite::filter_news_url($data['iso'], $dateformat->date_europeen_format($data['date_register']), $data['n_uri'], $data['keynews'], true);
             $this->rss->elementWriteAtom($data['n_title'], $data['date_register'], $uri, null, $data['n_content']);
         }
     }
 }
/**
* Smarty {widget_news_nav}
* function plugin
*
* Type:     function
* Name:     widget news nav
* Date:     September 26, 2012
* Update:   December  29, 2012
* Purpose:  
* Examples:

   {widget_news_nav}

   {widget_news_nav
       htmlAttribut=[
           'id_container' => 'secondary-nav',
           'class_container' => 'v-nav'
       ]
       title='<p class="title">Actualités par thèmes</p>'
   }

* Output: string (<ul><li><a>tag_name<///)
* @link
* @author   Gerits Aurelien
* @author   Samuel Lesre
* @version  1.1
* @param array
* @param Smarty
* @return string
*/
function smarty_function_widget_news_nav($params, $template)
{
    $ModelNews = new frontend_model_news();
    $ModelSystem = new magixglobal_model_system();
    // *** Load SQL DATA
    $current = $ModelSystem->setCurrentId();
    $conf = array('level' => 'tag', 'limit' => null);
    $data = $ModelNews->getData($conf, $current);
    $current = $current['news'];
    $output = null;
    if ($data != null) {
        // *** set default html attributs
        if ($params['htmlAttribut']) {
            $htmlAttr = $params['htmlAttribut'];
            $id_container = isset($htmlAttr['id_container']) ? ' id="' . $htmlAttr['id_container'] . '"' : null;
            $class_container = isset($htmlAttr['class_container']) ? ' class="' . $htmlAttr['class_container'] . '"' : null;
            $class_current = isset($htmlAttr['class_current']) ? $htmlAttr['class_current'] : 'current';
        }
        // *** Set translation var
        $tr_show_news = frontend_model_template::getConfigVars('show_news');
        // *** format items loop (foreach item)
        $items = null;
        foreach ($data as $row) {
            $current_item = $row['name_tag'] == $current['tag']['id'] ? $class_current : null;
            $uri_item = magixglobal_model_rewrite::filter_news_tag_url($row['iso'], urlencode($row['name_tag']), true);
            $name_item = $row['name_tag'];
            $class_item = $current_item != null ? ' class="' . $current_item . '"' : null;
            // *** item construct
            $item = '<li' . $class_item . '>';
            $item .= '<a href="' . $uri_item . '" title="' . $tr_show_news . ': ' . $name_item . '">';
            $item .= $name_item;
            $item .= '</a>';
            $item .= '</li>';
            $items .= $item;
        }
        // *** container construct
        $output = isset($params['title']) ? $params['title'] : '';
        $output .= '<ul' . $id_container . $class_container . '>';
        $output .= isset($params['prepend']) ? $params['prepend'] : null;
        $output .= $items;
        $output .= isset($params['append']) ? $params['append'] : null;
        $output .= '</ul>';
    }
    return $output;
}
Example #10
0
 /**
  * Retourne les produits du catalogue dans l'éditeur
  * @access private
  *
  */
 private function json_url_product()
 {
     if ($this->product_search != '') {
         if (parent::s_product_url($this->product_search) != null) {
             foreach (parent::s_product_url($this->product_search) as $key) {
                 $url_product = magixglobal_model_rewrite::filter_catalog_product_url($key['iso'], $key['pathclibelle'], $key['idclc'], $key['pathslibelle'], $key['idcls'], $key['urlcatalog'], $key['idproduct'], true);
                 $json[] = '{"idproduct":' . json_encode($key['idproduct']) . ',"titlecatalog":' . json_encode($key['titlecatalog']) . ',"category":' . json_encode($key['clibelle']) . ',"subcategory":' . json_encode($key['slibelle']) . ',"uriproduct":' . json_encode($url_product) . ',"iso":' . json_encode($key['iso']) . '}';
             }
             print '[' . implode(',', $json) . ']';
         }
     } else {
         print '{}';
     }
 }
Example #11
0
 /**
  * URL index du module suivant la langue
  * @param $idlang
  */
 public function sitemap_uri_index($idlang)
 {
     $sitemap = new magixcjquery_xml_sitemap();
     // Table des langues
     $lang = new backend_db_block_lang();
     // Retourne le code ISO
     $db = $lang->s_data_iso($idlang);
     if ($db != null) {
         $sitemap->writeMakeNode(magixcjquery_html_helpersHtml::getUrl() . magixglobal_model_rewrite::filter_plugins_root_url($db['iso'], 'contact', true), $this->lastmod_dateFormat(), 'always', 0.7);
     }
 }
Example #12
0
 /**
  * @param $row
  * @return array
  */
 private function setItemCartData($row)
 {
     $data = null;
     $newData = array();
     $ModelImagepath = new magixglobal_model_imagepath();
     $ModelTemplate = new frontend_model_template();
     foreach ($row as $key => $value) {
         $urlProduct = magixglobal_model_rewrite::filter_catalog_product_url($value['iso'], $value['pathclibelle'], $value['idclc'], $value['pathslibelle'], $value['idcls'], $value['urlcatalog'], $value['idproduct'], true);
         $newData[$key]['id_item'] = $value['id_item'];
         $newData[$key]['idcatalog'] = $value['idcatalog'];
         $newData[$key]['titlecatalog'] = $value['titlecatalog'];
         if ($value['imgcatalog']) {
             $newData[$key]['imgSrc'] = array('small' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'mini/' . $value['imgcatalog'], 'levelmod' => '')), 'medium' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'medium/' . $value['imgcatalog'], 'levelmod' => '')), 'large' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'product/' . $value['imgcatalog'], 'levelmod' => '')));
         }
         $newData[$key]['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/product-default.png'));
         $newData[$key]['imgcatalog'] = $value['imgcatalog'];
         $newData[$key]['urlproduct'] = $urlProduct;
         $newData[$key]['quantity'] = $value['quantity_items'];
         $newData[$key]['price'] = $value['price_items'];
         $newData[$key]['idattr'] = $value['idattr'];
         if (isset($value['idattr'])) {
             $newData[$key]['idattr'] = $value['idattr'];
             if ($value['idattr'] && $value['idattr'] != null) {
                 $newData[$key]['title_attr'] = $value['title_attribute'];
                 $newData[$key]['idgroup'] = $value['idgroup'];
             }
         }
         //$newData[$key]['fixed_costs']     = $value['fixed_costs'];
         //$newData[$key]['weight']          = !is_null($value['weight']) ? ($value['weight']*$value['quantity_items']) : null;
         //$newData[$key]['marking_costs']   = !is_null($value['marking_costs']) ? $value['marking_costs']/*($value['quantity_items']*$value['marking_costs'])*/ : null;
         $newData[$key]['price_products'] = $value['price_items'];
         $newData[$key]['sub_amount'] = number_format($value['quantity_items'] * $value['price_items'], 2, '.', '');
     }
     return $newData;
 }
Example #13
0
 /**
  * Retourne au format JSON les liens des pages
  */
 public function json_url_page()
 {
     if ($this->page_search != '') {
         if (parent::s_page_url($this->page_search) != null) {
             foreach (parent::s_page_url($this->page_search) as $key) {
                 if ($key['idcat_p'] != 0) {
                     $url_cms = magixglobal_model_rewrite::filter_cms_url($key['iso'], $key['idcat_p'], $key['url_category'], $key['idpage'], $key['url_page'], true);
                 } else {
                     $url_cms = magixglobal_model_rewrite::filter_cms_url($key['iso'], null, null, $key['idpage'], $key['url_page'], true);
                 }
                 $json[] = '{"idpage":' . json_encode($key['idpage']) . ',"title_page":' . json_encode($key['title_page']) . ',"idcat_p":' . json_encode($key['idcat_p']) . ',"iso":' . json_encode(magixcjquery_string_convert::upTextCase($key['iso'])) . ',"url_cms":' . json_encode($url_cms) . ',"page_category":' . json_encode($key['page_category']) . '}';
             }
             print '[' . implode(',', $json) . ']';
         }
     } else {
         print '{}';
     }
 }