Code Duplication    Length = 44-44 lines in 2 locations

product.php 2 locations

@@ 416-459 (lines=44) @@
413
        // x derniers produits toutes catégories confondues *************************************************
414
        $count = Oledrion_utils::getModuleOption('summarylast');
415
        $xoopsTpl->assign('summarylast', $count);
416
        if ($count > 0) {
417
            $tblTmp = array();
418
            $tblTmp = $h_oledrion_products->getRecentProducts(new Oledrion_parameters(array(
419
                                                                                          'start'    => 0,
420
                                                                                          'limit'    => $count,
421
                                                                                          'category' => 0,
422
                                                                                          'sort'     => 'product_submitted DESC, product_title',
423
                                                                                          'order'    => '',
424
                                                                                          'excluded' => $product_id
425
                                                                                      )));
426
            foreach ($tblTmp as $item) {
427
                $product_price     = $item->getVar('product_price');
428
                $product_price_ttc = Oledrion_utils::getTTC($item->getVar('product_price'), '');
429
                if ($h_oledrion_attributes->getProductAttributesCount($item->getVar('product_id')) > 0) {
430
                    $criteria = new CriteriaCompo();
431
                    $criteria->add(new Criteria('attribute_product_id', $item->getVar('product_id')));
432
                    $attribute = $h_oledrion_attributes->getObjects($criteria, false);
433
                    foreach ($attribute as $root) {
434
                        $product_price     = $root->getVar('attribute_default_value');
435
                        $product_price_ttc = Oledrion_utils::getTTC($root->getVar('attribute_default_value'), '');
436
                    }
437
                }
438
                $datas = array(
439
                    'last_categ_product_title'        => $item->getVar('product_title'),
440
                    'last_categ_product_url_rewrited' => $item->getLink(),
441
                    'last_categ_product_href_title'   => Oledrion_utils::makeHrefTitle($item->getVar('product_title')),
442
                    'product_thumb_url'               => $item->getVar('product_thumb_url'),
443
                    'product_thumb_full_url'          => $item->getThumbUrl(),
444
                    'product_url_rewrited'            => $item->getLink(),
445
                    'product_href_title'              => Oledrion_utils::makeHrefTitle($item->getVar('product_title')),
446
                    'product_title'                   => $item->getVar('product_title'),
447
                    'product_property1'               => $item->getVar('product_property1'),
448
                    'product_property2'               => $item->getVar('product_property2'),
449
                    'product_property3'               => $item->getVar('product_property3'),
450
                    'product_property4'               => $item->getVar('product_property4'),
451
                    'product_property5'               => $item->getVar('product_property5'),
452
                    'product_property6'               => $item->getVar('product_property6'),
453
                    'product_property7'               => $item->getVar('product_property7'),
454
                    'product_property8'               => $item->getVar('product_property8'),
455
                    'product_property9'               => $item->getVar('product_property9'),
456
                    'product_property10'              => $item->getVar('product_property10'),
457
                    'product_id'                      => $item->getVar('product_id'),
458
                    'product_new'                     => $item->isNewProduct(),
459
                    'product_stock'                   => $item->getVar('product_stock'),
460
                    'product_price'                   => $product_price,
461
                    'product_price_ttc'               => $product_price_ttc
462
                );
@@ 471-514 (lines=44) @@
468
        // x derniers produits dans cette catégorie *********************************************************
469
        $count = Oledrion_utils::getModuleOption('summarycategory');
470
        $xoopsTpl->assign('summarycategory', $count);
471
        if ($count > 0) {
472
            $tblTmp = array();
473
            $tblTmp = $h_oledrion_products->getRecentProducts(new Oledrion_parameters(array(
474
                                                                                          'start'    => 0,
475
                                                                                          'limit'    => $count,
476
                                                                                          'category' => $product->getVar('product_cid'),
477
                                                                                          'sort'     => 'product_submitted DESC, product_title',
478
                                                                                          'order'    => '',
479
                                                                                          'excluded' => $product_id
480
                                                                                      )));
481
            foreach ($tblTmp as $item) {
482
                $product_price     = $item->getVar('product_price');
483
                $product_price_ttc = Oledrion_utils::getTTC($item->getVar('product_price'), '');
484
                if ($h_oledrion_attributes->getProductAttributesCount($item->getVar('product_id')) > 0) {
485
                    $criteria = new CriteriaCompo();
486
                    $criteria->add(new Criteria('attribute_product_id', $item->getVar('product_id')));
487
                    $attribute = $h_oledrion_attributes->getObjects($criteria, false);
488
                    foreach ($attribute as $root) {
489
                        $product_price     = $root->getVar('attribute_default_value');
490
                        $product_price_ttc = Oledrion_utils::getTTC($root->getVar('attribute_default_value'), '');
491
                    }
492
                }
493
                $datas = array(
494
                    'last_categ_product_title'        => $item->getVar('product_title'),
495
                    'last_categ_product_url_rewrited' => $item->getLink(),
496
                    'last_categ_product_href_title'   => Oledrion_utils::makeHrefTitle($item->getVar('product_title')),
497
                    'product_thumb_url'               => $item->getVar('product_thumb_url'),
498
                    'product_thumb_full_url'          => $item->getThumbUrl(),
499
                    'product_url_rewrited'            => $item->getLink(),
500
                    'product_href_title'              => Oledrion_utils::makeHrefTitle($item->getVar('product_title')),
501
                    'product_title'                   => $item->getVar('product_title'),
502
                    'product_property1'               => $item->getVar('product_property1'),
503
                    'product_property2'               => $item->getVar('product_property2'),
504
                    'product_property3'               => $item->getVar('product_property3'),
505
                    'product_property4'               => $item->getVar('product_property4'),
506
                    'product_property5'               => $item->getVar('product_property5'),
507
                    'product_property6'               => $item->getVar('product_property6'),
508
                    'product_property7'               => $item->getVar('product_property7'),
509
                    'product_property8'               => $item->getVar('product_property8'),
510
                    'product_property9'               => $item->getVar('product_property9'),
511
                    'product_property10'              => $item->getVar('product_property10'),
512
                    'product_id'                      => $item->getVar('product_id'),
513
                    'product_new'                     => $item->isNewProduct(),
514
                    'product_stock'                   => $item->getVar('product_stock'),
515
                    'product_price'                   => $product_price,
516
                    'product_price_ttc'               => $product_price_ttc
517
                );