-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/cabinetsbay/site/issues/146
- Loading branch information
1 parent
4db8060
commit f7c5822
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
# 2024-05-06 Dmitrii Fediuk https://upwork.com/fl/mage2pro | ||
# "Refactor `app/design/frontend/Cabinetsbay/cabinetsbay_default/Magento_Theme/templates/homepage.phtml`": | ||
# https://github.com/cabinetsbay/site/issues/146 | ||
use Exception as E; | ||
use Magento\Catalog\Model\Category as C; | ||
use Magento\Catalog\Model\ResourceModel\Category\Collection as CC; | ||
use Magento\Framework\View\Element\Template as B; | ||
/** @var B $block */ $b = $block; /** @var B $b */ | ||
?> | ||
<div class="homepage-grid"> | ||
<?= df_cms_block('home-page-slider') ?> | ||
<div class="homepage-why-us"> | ||
<?= df_cc_n(df_cms_block('home-page-why-us'), df_cms_block('home-page-why-us-icon-block')) ?> | ||
</div> | ||
<div class="homepage-popular c-products-grid"> | ||
<?php | ||
$cc = df_category_c(array_slice(df_csv_parse_int(df_cfg('cabinetsbay_settings/general/popular_products')), 0, 3)) | ||
->addAttributeToSelect(['cb_door_sample_link', 'cb_kitchen_price', 'cb_kitchen_set', 'image', 'name']) | ||
->joinUrlRewrite() | ||
; /** @var CC $cc */ | ||
?> | ||
<?php if (count($cc)) : ?> | ||
<?= df_cms_block('home-page-popular-kitchen') ?> | ||
<ul> <?php | ||
foreach ($cc as $popularProduct) { | ||
/** @var C $popularProduct */ | ||
print '<li>'; | ||
print '<a href="' . $popularProduct->getUrl() . '">'; | ||
print '<div>' . $popularProduct->getName() . '</div>'; | ||
if($popularProduct->getData('cb_kitchen_set') != '') { | ||
print '<div class="size-price"><b>' . $popularProduct->getData('cb_kitchen_set') . '</b>' . $popularProduct->getData('cb_kitchen_price') . '</div>'; | ||
} | ||
try { | ||
print '<img src="' . $popularProduct->getImageUrl() . '" border="0" />'; | ||
} catch (E $e) {} | ||
print '</a>'; | ||
print '<div><a href="' . $popularProduct->getUrl() | ||
. '">Shop cabinets</a><a href="'.$popularProduct->getData('cb_door_sample_link').'">Order sample</a></div>'; | ||
print '</li>'; | ||
} | ||
print '</ul>'; | ||
endif; ?> | ||
</div> | ||
<div class="homepage-workflow"><?= df_cms_block('home-page-project-workflow') ?></div> | ||
<div class="homepage-affirm-banner"> | ||
<a href="/financing.html"><img src="<?= $b->getViewFileUrl('images/affirm_banner.svg') ?>"/></a> | ||
</div> | ||
<div class="homepage-affirm-banner-mobile"> | ||
<a href="/financing.html"><img src="<?= $b->getViewFileUrl('images/affirm_banner_mob.svg') ?>"/></a> | ||
</div> | ||
<div class="homepage-call-us"> | ||
<div class="left"> | ||
<div class="call-us-block"> | ||
<h4>Call Us Today</h4> | ||
<h4><?= trim(strip_tags(df_cms_block('block-header-top-phone'), '<a>')) ?></h4> | ||
</div> | ||
<div><?= trim(strip_tags(df_cms_block('home-page-schedule'), '<br>')) ?></div> | ||
</div> | ||
<div class="right"> | ||
<div class="catalog-links"> | ||
<div><?= trim(strip_tags(df_cms_block('home-page-catalog-links'), '<a><ul><li>')) ?></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |