Skip to content

Commit

Permalink
https://github.com/cabinetsbay/site/issues/146
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed May 7, 2024
1 parent 4db8060 commit f7c5822
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions view/frontend/templates/home.phtml
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>

0 comments on commit f7c5822

Please sign in to comment.