Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save incrize/b37c627097ef10bb7389 to your computer and use it in GitHub Desktop.
Save incrize/b37c627097ef10bb7389 to your computer and use it in GitHub Desktop.
diff --git a/app/schemas/exim/products.functions.php b/app/schemas/exim/products.functions.php
index 2b87382..aaa4907 100644
--- a/app/schemas/exim/products.functions.php
+++ b/app/schemas/exim/products.functions.php
@@ -408,6 +408,10 @@ function fn_exim_set_product_features($product_id, $data, $features_delimiter, $
);
if (empty($feature_id)) {
+ if (fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) {
+ fn_set_notification('W', __('warning'), __('exim_vendor_cant_create_feature'));
+ continue;
+ }
$feature_data = array(
'description' => $feature['name'],
'company_id' => $company_id,
@@ -434,7 +438,6 @@ function fn_exim_set_product_features($product_id, $data, $features_delimiter, $
function fn_exim_product_feature_variants($feature, $feature_id, $variants, $lang_code)
{
$feature_type = $feature['type'];
-
if (strpos(ProductFeatures::getSelectable(), $feature_type) !== false) { // variant IDs
$vars = array();
@@ -451,6 +454,10 @@ function fn_exim_product_feature_variants($feature, $feature_id, $variants, $lan
foreach ($feature['variants'] as $variant_data) {
if (!in_array($variant_data['name'], $existent_variants)) {
+ if (fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) {
+ fn_set_notification('W', __('warning'), __('exim_vendor_cant_create_feature'));
+ continue;
+ }
$variant_id = fn_add_feature_variant($feature_id, array('variant' => $variant_data['name']));
$existent_variants[$variant_id] = $variant_data['name'];
}
diff --git a/var/langs/en/core.po b/var/langs/en/core.po
index 5b0351d..973a8b4 100644
--- a/var/langs/en/core.po
+++ b/var/langs/en/core.po
@@ -15732,3 +15732,7 @@ msgstr "For a complete shopping experience, please <a href=\"http://www.wikihow.
msgctxt "Languages::uc_restore_email_subject"
msgid "Upgrade center: Store has been backed up and closed."
msgstr "Upgrade center: Store has been backed up and closed."
+
+msgctxt "Languages::exim_vendor_cant_create_feature"
+msgid "Vendors cannot create product features and their variants. Some product features cannot be modified."
+msgstr "Vendors cannot create product features and their variants. Some product features cannot be modified."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment