Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save uzaharova/a06b54d68902e2c1ebc4afcb1c64a41d to your computer and use it in GitHub Desktop.
Save uzaharova/a06b54d68902e2c1ebc4afcb1c64a41d to your computer and use it in GitHub Desktop.
diff --git a/app/addons/discussion/schemas/block_manager/templates.post.php b/app/addons/discussion/schemas/block_manager/templates.post.php
new file mode 100644
index 0000000..2525afc
--- /dev/null
+++ b/app/addons/discussion/schemas/block_manager/templates.post.php
@@ -0,0 +1,20 @@
+<?php
+/***************************************************************************
+ * *
+ * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
+ * *
+ * This is commercial software, only users who have purchased a valid *
+ * license and accept to the terms of the License Agreement can install *
+ * and use this program. *
+ * *
+ ****************************************************************************
+ * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
+ * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
+ ****************************************************************************/
+
+$schema['blocks/vendors_templates/featured_vendors.tpl']['settings']['show_rating'] = array (
+ 'type' => 'checkbox',
+ 'default_value' => 'Y'
+);
+
+return $schema;
diff --git a/app/functions/fn.companies.php b/app/functions/fn.companies.php
index 5e27230..95c2914 100644
--- a/app/functions/fn.companies.php
+++ b/app/functions/fn.companies.php
@@ -1445,3 +1445,32 @@ function fn_create_company_admin($company_data, $fields = '', $notify = false)
return $user;
}
+
+/**
+ * @param array $params
+ *
+ * @return array|string
+ */
+function fn_get_companies_data($params = array())
+{
+ list($companies_all, $search) = fn_get_companies($params, $auth);
+
+ $return = array(
+ 'companies' => array(),
+ 'count' => count($companies_all),
+ );
+
+ foreach ($companies_all as $company) {
+ $company_data = fn_get_company_data($company['company_id']);
+ $company_data['logos'] = fn_get_logos($company['company_id']);
+
+ $company_data['total_products'] = count(db_get_fields(fn_get_products(array(
+ 'get_query' => true,
+ 'company_id' => $company['company_id']
+ ))));
+
+ $return['companies'][$company['company_id']] = array_merge($company, $company_data);
+ }
+
+ return array($return);
+}
diff --git a/app/schemas/block_manager/blocks.php b/app/schemas/block_manager/blocks.php
index 336581d..8842f9e 100644
--- a/app/schemas/block_manager/blocks.php
+++ b/app/schemas/block_manager/blocks.php
@@ -832,7 +832,7 @@ if (fn_allowed_for('MULTIVENDOR')) {
'object' => 'vendors',
'remove_indent' => true,
'hide_label' => true,
- 'items_function' => 'fn_get_short_companies',
+ 'items_function' => 'fn_get_companies_data',
'fillings' => array(
'all' => array(),
'manually' => array(
@@ -850,7 +850,7 @@ if (fn_allowed_for('MULTIVENDOR')) {
'default_value' => '10'
)
),
- 'templates' => 'blocks/featured_shops.tpl',
+ 'templates' => 'blocks/vendors_templates',
'wrappers' => 'blocks/wrappers',
'cache' => array(
'update_handlers' => array('companies', 'company_descriptions'),
diff --git a/app/schemas/block_manager/templates.php b/app/schemas/block_manager/templates.php
index 323ae6d..6ddf872 100644
--- a/app/schemas/block_manager/templates.php
+++ b/app/schemas/block_manager/templates.php
@@ -396,8 +396,15 @@ return array(
),
),
),
+/* Companies templates */
+ 'blocks/vendors_templates/companies_list.tpl' => array (
+ 'fillings' => array ('all', 'manually'),
+ 'params' => array (
+ 'status' => 'A',
+ ),
+ ),
/* Featured shops templates */
- 'blocks/featured_shops.tpl' => array (
+ 'blocks/vendors_templates/featured_vendors.tpl' => array (
'settings' => array(
'number_of_columns' => array (
'type' => 'input',
@@ -407,10 +414,6 @@ return array(
'type' => 'checkbox',
'default_value' => 'Y'
),
- 'show_rating' => array (
- 'type' => 'checkbox',
- 'default_value' => 'Y'
- ),
'show_total_products' => array (
'type' => 'checkbox',
'default_value' => 'Y'
deleted file mode 100644
index f004d8a..0000000
--- a/design/themes/responsive/templates/blocks/featured_shops.tpl
+++ /dev/null
@@ -1,75 +0,0 @@
-{** block-description:vendors **}
-
-{if $block.properties.show_location == "Y"}
- {$show_location=true}
-{else}
- {$show_location=false}
-{/if}
-{if $block.properties.show_rating == "Y"}
- {$show_rating=true}
-{else}
- {$show_rating=false}
-{/if}
-{if $block.properties.show_total_products == "Y"}
- {$show_total_products=true}
-{else}
- {$show_total_products=false}
-{/if}
-
-{$companies=$items.companies}
-{$columns=$block.properties.number_of_columns}
-{$obj_prefix="`$block.block_id`000"}
-
-{if $companies}
- {split data=$companies size=$columns|default:"5" assign="splitted_companies"}
- {math equation="100 / x" x=$columns|default:"5" assign="cell_width"}
-
- <div class="grid-list ty-grid-vendors">
- {strip}
- {foreach from=$splitted_companies item="scompanies" name="scomp"}
- {foreach from=$scompanies item="company" name="scompanies"}
- <div class="ty-column{$columns}">
- {if $company}
- {assign var="obj_id" value=$company.company_id}
- {assign var="obj_id_prefix" value="`$obj_prefix``$company.company_id`"}
- {include file="common/company_data.tpl" company=$company hide_links=false show_logo=true show_city=true show_country=true}
-
- <div class="ty-grid-list__item">
- {assign var="form_open" value="form_open_`$obj_id`"}
- {$smarty.capture.$form_open nofilter}
- {hook name="companies:featured_shops"}
- <div class="ty-grid-list__company-logo">
- {assign var="logo" value="logo_`$obj_id`"}
- {$smarty.capture.$logo nofilter}
- </div>
-
- {if $show_location}
- <div class="ty-grid-list__item-location">
- {assign var="city" value="city_`$obj_id`"}
- {assign var="country" value="country_`$obj_id`"}
- <a href="{"companies.products?company_id=`$company.company_id`"|fn_url}" class="company-location"><bdi>{$smarty.capture.$city nofilter}, {$smarty.capture.$country nofilter}</bdi></a>
- </div>
- {/if}
-
- {assign var="rating" value="rating_`$obj_id`"}
- {if $smarty.capture.$rating && $show_rating}
- <div class="grid-list__rating">
- {$smarty.capture.$rating nofilter}
- </div>
- {/if}
-
- <div class="ty-grid-list__total-products">
- {assign var="total_products" value="total_products_`$obj_id`"}
- {if $smarty.capture.$total_products && $show_total_products}
- {$smarty.capture.$total_products nofilter}
- {/if}
- </div>
- {/hook}
- </div>
- {/if}
- </div>
- {/foreach}
- {/foreach}
- {/strip}
- </div>
-{/if}
\ No newline at end of file
diff --git a/design/themes/bright_theme/layouts/layouts_multivendor.xml b/design/themes/bright_theme/layouts/layouts_multivendor.xml
index 62b25c0..05dff13 100644
--- a/design/themes/bright_theme/layouts/layouts_multivendor.xml
+++ b/design/themes/bright_theme/layouts/layouts_multivendor.xml
@@ -771,7 +771,7 @@ Monday - Friday</li>
<block>
<type><![CDATA[vendors]]></type>
<properties>
- <template><![CDATA[blocks/featured_shops.tpl]]></template>
+ <template><![CDATA[blocks/featured_vendors.tpl]]></template>
<number_of_columns><![CDATA[5]]></number_of_columns>
<show_location><![CDATA[Y]]></show_location>
<show_rating><![CDATA[Y]]></show_rating>
diff --git a/design/themes/responsive/layouts/layouts_multivendor.xml b/design/themes/responsive/layouts/layouts_multivendor.xml
index 83e9103..e9be9c8 100644
--- a/design/themes/responsive/layouts/layouts_multivendor.xml
+++ b/design/themes/responsive/layouts/layouts_multivendor.xml
@@ -831,7 +831,7 @@
<block>
<type><![CDATA[vendors]]></type>
<properties>
- <template><![CDATA[blocks/featured_shops.tpl]]></template>
+ <template><![CDATA[blocks/featured_vendors.tpl]]></template>
<number_of_columns><![CDATA[5]]></number_of_columns>
<show_location><![CDATA[Y]]></show_location>
<show_rating><![CDATA[Y]]></show_rating>
diff --git a/design/themes/responsive/templates/blocks/vendors_templates/companies_list.tpl b/design/themes/responsive/templates/blocks/vendors_templates/companies_list.tpl
new file mode 100644
index 0000000..14b0ae7
--- /dev/null
+++ b/design/themes/responsive/templates/blocks/vendors_templates/companies_list.tpl
@@ -0,0 +1,13 @@
+{** block-description:vendor_list **}
+
+{if $items.companies}
+ <ul>
+ {foreach from=$items.companies item=v key=k}
+ <li><a href="{"companies.products?company_id=`$k`"|fn_url}">{$v}</a></li>
+ {/foreach}
+ </ul>
+
+ <div class="ty-homepage-vendors__devider">
+ <a class="ty-btn ty-btn__tertiary" href="{"companies.catalog"|fn_url}">{__("all_vendors")}</a>
+ </div>
+{/if}
\ No newline at end of file
diff --git a/var/langs/en/editions/mve.po b/var/langs/en/editions/mve.po
index 58a57f2..30823d6 100644
--- a/var/langs/en/editions/mve.po
+++ b/var/langs/en/editions/mve.po
@@ -683,3 +683,11 @@ msgstr "Vendor language"
msgctxt "Languages::zipcode"
msgid "Zipcode"
msgstr "Zipcode"
+
+msgctxt "Languages::vendor_list"
+msgid "Vendor list"
+msgstr "Vendor list"
+
+msgctxt "Languages::featured_vendors"
+msgid "Featured vendors"
+msgstr "Featured vendors"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment