Skip to content

Commit 76915ab

Browse files
committed
first code
0 parents  commit 76915ab

File tree

11 files changed

+620
-0
lines changed

11 files changed

+620
-0
lines changed
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
<?php
2+
/**
3+
* BSS Commerce Co.
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the EULA
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://bsscommerce.com/Bss-Commerce-License.txt
11+
*
12+
* =================================================================
13+
* MAGENTO EDITION USAGE NOTICE
14+
* =================================================================
15+
* This package designed for Magento COMMUNITY edition
16+
* BSS Commerce does not guarantee correct work of this extension
17+
* on any other Magento edition except Magento COMMUNITY edition.
18+
* BSS Commerce does not provide extension support in case of
19+
* incorrect edition usage.
20+
* =================================================================
21+
*
22+
* @category BSS
23+
* @package Bss_CustomProductAttributeExport
24+
* @author Extension Team
25+
* @copyright Copyright (c) 2015-2016 BSS Commerce Co. ( http://bsscommerce.com )
26+
* @license http://bsscommerce.com/Bss-Commerce-License.txt
27+
*/
28+
namespace Bss\CustomProductAttributeExport\Model\Config\Source;
29+
30+
class Allowedattribute implements \Magento\Framework\Option\ArrayInterface
31+
{
32+
private $coll;
33+
protected $exportMainAttrCodes = [
34+
'sku',
35+
'attribute_set',
36+
'type',
37+
'product_websites',
38+
'category_ids',
39+
'store',
40+
'name',
41+
'description',
42+
'short_description',
43+
'weight',
44+
'product_online',
45+
'tax_class_name',
46+
'visibility',
47+
'price',
48+
'special_price',
49+
'special_price_from_date',
50+
'special_price_to_date',
51+
'url_key',
52+
'meta_title',
53+
'meta_keywords',
54+
'meta_description',
55+
'base_image',
56+
'base_image_label',
57+
'small_image',
58+
'small_image_label',
59+
'thumbnail_image',
60+
'thumbnail_image_label',
61+
'swatch_image',
62+
'swatch_image_label',
63+
'created_at',
64+
'updated_at',
65+
'new_from_date',
66+
'new_to_date',
67+
'display_product_options_in',
68+
'map_price',
69+
'msrp_price',
70+
'map_enabled',
71+
'special_price_from_date',
72+
'special_price_to_date',
73+
'gift_message_available',
74+
'custom_design',
75+
'custom_design_from',
76+
'custom_design_to',
77+
'custom_layout_update',
78+
'page_layout',
79+
'product_options_container',
80+
'msrp_price',
81+
'msrp_display_actual_price_type',
82+
'map_enabled',
83+
'country_of_manufacture',
84+
'map_price',
85+
'display_product_options_in',
86+
'related_skus',
87+
'related_position',
88+
'crosssell_skus',
89+
'crosssell_position',
90+
'upsell_skus',
91+
'upsell_position',
92+
'additional_images',
93+
'additional_image_labels',
94+
'hide_from_product_page',
95+
'custom_layout',
96+
'gallery',
97+
'has_options',
98+
'image',
99+
'image_lable',
100+
'links_exist',
101+
'links_purchased_separately',
102+
'links_title',
103+
'media_gallery',
104+
'meta_keyword',
105+
'minimal_price',
106+
'msrp',
107+
'news_from_date',
108+
'news_to_date',
109+
'old_id',
110+
'options_container',
111+
'price_type',
112+
'price_view',
113+
'quantity_and_stock_status',
114+
'required_options',
115+
'samples_title',
116+
'shipment_type',
117+
'sku_type',
118+
'special_from_date',
119+
'special_to_date',
120+
'status',
121+
'tax_class_id',
122+
'thumbnail',
123+
'thumbnail_label',
124+
'tier_price',
125+
'url_path',
126+
'image_label',
127+
'weight_type'
128+
];
129+
130+
public function __construct(
131+
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection $coll
132+
) {
133+
$this->coll = $coll;
134+
}
135+
136+
public function toOptionArray()
137+
{
138+
$this->coll->addFieldToFilter(\Magento\Eav\Model\Entity\Attribute\Set::KEY_ENTITY_TYPE_ID, 4);
139+
$attrAll = $this->coll->load()->getItems();
140+
$array = [];
141+
foreach ($attrAll as $attribute) {
142+
if ((!in_array($attribute['attribute_code'], $this->exportMainAttrCodes)) &&
143+
($attribute->getIsSystem() == 0)
144+
) {
145+
$array[] = [
146+
'value' => $attribute["attribute_code"],
147+
'label' => $attribute["frontend_label"] . ' ('. $attribute["attribute_code"].')'
148+
];
149+
}
150+
}
151+
return $array;
152+
}
153+
154+
public function toArray()
155+
{
156+
return ['yes' => __('yes'),'no' => __('?no')];
157+
}
158+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/**
3+
* BSS Commerce Co.
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the EULA
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://bsscommerce.com/Bss-Commerce-License.txt
11+
*
12+
* =================================================================
13+
* MAGENTO EDITION USAGE NOTICE
14+
* =================================================================
15+
* This package designed for Magento COMMUNITY edition
16+
* BSS Commerce does not guarantee correct work of this extension
17+
* on any other Magento edition except Magento COMMUNITY edition.
18+
* BSS Commerce does not provide extension support in case of
19+
* incorrect edition usage.
20+
* =================================================================
21+
*
22+
* @category BSS
23+
* @package Bss_CustomProductAttributeExport
24+
* @author Extension Team
25+
* @copyright Copyright (c) 2015-2016 BSS Commerce Co. ( http://bsscommerce.com )
26+
* @license http://bsscommerce.com/Bss-Commerce-License.txt
27+
*/
28+
namespace Bss\CustomProductAttributeExport\Model\Rewrite\CatalogImportExport\Export;
29+
30+
class Product extends \Magento\CatalogImportExport\Model\Export\Product
31+
{
32+
protected function setHeaderColumns($customOptionsData, $stockItemRows)
33+
{
34+
$config = \Magento\Framework\App\ObjectManager::getInstance()
35+
->get('Magento\Framework\App\Config\ScopeConfigInterface');
36+
$moduleEnabled = (bool)$config->getValue('customproductattributeexport/configuration/enable');
37+
$merge = [];
38+
if ($moduleEnabled) {
39+
$attr = $config->getValue('customproductattributeexport/configuration/allowedattribute');
40+
$merge = explode(',', $attr);
41+
}
42+
43+
if (!$this->_headerColumns) {
44+
$customOptCols = [
45+
'custom_options',
46+
];
47+
$this->_headerColumns = array_merge(
48+
[
49+
self::COL_SKU,
50+
self::COL_STORE,
51+
self::COL_ATTR_SET,
52+
self::COL_TYPE,
53+
self::COL_CATEGORY,
54+
self::COL_PRODUCT_WEBSITES,
55+
],
56+
$this->_getExportMainAttrCodes(),
57+
$merge,
58+
[self::COL_ADDITIONAL_ATTRIBUTES],
59+
reset($stockItemRows) ? array_keys(end($stockItemRows)) : [],
60+
[],
61+
[
62+
'related_skus',
63+
'related_position',
64+
'crosssell_skus',
65+
'crosssell_position',
66+
'upsell_skus',
67+
'upsell_position'
68+
],
69+
['additional_images', 'additional_image_labels', 'hide_from_product_page']
70+
);
71+
// have we merge custom options columns
72+
if ($customOptionsData) {
73+
$this->_headerColumns = array_merge($this->_headerColumns, $customOptCols);
74+
}
75+
}
76+
}
77+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* BSS Commerce Co.
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the EULA
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://bsscommerce.com/Bss-Commerce-License.txt
11+
*
12+
* =================================================================
13+
* MAGENTO EDITION USAGE NOTICE
14+
* =================================================================
15+
* This package designed for Magento COMMUNITY edition
16+
* BSS Commerce does not guarantee correct work of this extension
17+
* on any other Magento edition except Magento COMMUNITY edition.
18+
* BSS Commerce does not provide extension support in case of
19+
* incorrect edition usage.
20+
* =================================================================
21+
*
22+
* @category BSS
23+
* @package Bss_CustomProductAttributeExport
24+
* @author Extension Team
25+
* @copyright Copyright (c) 2015-2016 BSS Commerce Co. ( http://bsscommerce.com )
26+
* @license http://bsscommerce.com/Bss-Commerce-License.txt
27+
*/
28+
namespace Bss\CustomProductAttributeExport\Plugin\Magento\CatalogImportExport\Model\Export;
29+
30+
class Product
31+
{
32+
protected $scopeConfig;
33+
public function __construct(
34+
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
35+
) {
36+
$this->scopeConfig = $scopeConfig;
37+
}
38+
39+
public function afterSetHeaderColumns(
40+
\Magento\CatalogImportExport\Model\Export\Product $subject,
41+
$result
42+
) {
43+
$config = $this->scopeConfig->getValue(
44+
'customproductattributeexport/configuration/enable',
45+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
46+
);
47+
}
48+
}

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Custom Product Attribute Export for Magento 2
2+
3+
This [Magento 2 Custom Product Attribute Export Free Extension](https://bsscommerce.com/custom-product-attribute-export-for-magento-2.html) can be reviewed as a perfect choice with the main purpose of supporting custom attributes in separate columns when exporting products in CSV file. With the development of this module, store admin will feel easier in managing a shop online.
4+
5+
## 1. Documentation
6+
7+
- Installation guide: <a href="https://bsscommerce.com/media/attachments/122_58c24b9502429_Installation_Guide-Custom_Product_Attribute_Export_for_Magento_2_Extension.pdf" target="_blank">Get It Now!</a>
8+
- User Guide: <a href="https://bsscommerce.com/media/attachments/122_58c24b852ad62_User_Guide-Custom_Product_Attribute_Export_for_Magento_2_Extension.pdf" target="_blank">Get It Now!</a>
9+
- Download from our Live site: https://bsscommerce.com/custom-product-attribute-export-for-magento-2.html
10+
- Get Support: https://bsscommerce.freshdesk.com/support/home/
11+
12+
## 2. How to install
13+
14+
After finishing purchasing process, we will immediately send you an email containing the link to download this extension.
15+
16+
- **Step 1**: Unzip the file.
17+
- **Step 2**: Create another directory called app/code/Bss/CustomProductAttributeExport . Then, you put the contents of the extension ZIP file in there.
18+
- **Step 3**: Upload the directory app/code/Bss/CustomProductAttributeExport into the root directory of your Magento installation. The root directory of Magento is the directory that contains the directories "app", "bin", "lib" and more. All directories should match the existing directory structure.
19+
- **Step 4**: Go to Magento 2 root directory. Run: php bin/magento setup:upgrade.
20+
- **Step 5**: Run: php bin/magento setup:static-content:deploy.
21+
- **Step 6**: Clear all Caches.
22+
23+
## 3. Detailed Functions
24+
25+
[Custom Product Attribute Export for Magento 2](https://bsscommerce.com/custom-product-attribute-export-for-magento-2.html) will be a promising module which can improve default Magento 2 with more practical functions. In default Magento 2, all custom attributes still appear in CSV export file but in one column only. The attributes in this “additional_attributes” column are split up by a comma. That is the reason why this Magento 2 Free Extension is built to deal with the issue quickly.
26+
**Here are some crucial features of this extension:**
27+
28+
- **Divide custom attributes into different columns after being exported**
29+
This function will support custom attributes by showing them in different columns instead of one column like in the default.
30+
31+
![product_export_column_csv_file.png](https://bsscommerce.com/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/p/r/product_export_column_csv_file.png)
32+
33+
- **Choose various custom attributes to apply module as demand**
34+
35+
This feature allows store admin to select the suitable custom attributes to put them into separate columns when exporting products in the backend.
36+
37+
![product_export_column_backend.png](https://bsscommerce.com/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/p/r/product_export_column_backend.png)
38+
39+
- **Update new custom attributes in module config automatically**
40+
41+
Any changes of custom attributes will be up to date immediately in the configuration of the module.
42+
43+
**Full vital features of Magento 2 Custom Product Attributes Export:**
44+
- Export custom attributes into independent columns of the CSV file.
45+
- Select multiple custom attributes to apply module.
46+
- Update new custom attributes in module config automatically.
47+
48+
## 4. User Guide
49+
50+
Please go to **Stores ➨ Configuration ➨ BSSCOMMERCE ➨ Product Export Column** and start configuration.
51+
52+
![product_export_column_backend.png](https://bsscommerce.com/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/p/r/product_export_column_backend.png)
53+
54+
In **Enable**: Choose **Yes** to enable the module or choose **No** to disable it.
55+
In **Allowed Attribute**: Choose the custom product attributes which you want to be in separate column when exporting products.
56+
57+
## 5. Other helpful Magento 2 Extensions by BSSCommerce
58+
59+
60+
[Import Export Product Attributes](https://bsscommerce.com/magento-2-import-export-product-attributes.html): allows admin to easily import and export multiple product attributes via a CSV file.
61+
62+
[Import Export Product Reviews](https://bsscommerce.com/import-export-product-reviews-for-magento-2.html): allows admin to import and export product reviews via a CSV file
63+
64+
[Import Export URL Rewrites](https://bsscommerce.com/magento-2-import-export-url-rewrites-extension.html): help admin to import and export URL rewrites via a CSV file.
65+
66+
[Import Export Wishlist Item](https://bsscommerce.com/magento-2-import-export-wishlist-item-extension.html): allow admin to import and export wishlist items via a CSV file
67+
68+
[Inventory Report](https://bsscommerce.com/magento-2-inventory-report-extension.html): saves quantity changes of your products all the times.
69+
70+
[Admin Action Log](https://bsscommerce.com/magento-2-admin-action-log-extension.html): keeps track all activities in the backend of administrators.
71+
72+
[Admin Notification Email](https://bsscommerce.com/magento-2-admin-email-notification-extension.html): immediately sends the notification email to admin whenever a key event happens in your store.
73+
74+
[Admin product Preview Plus](https://bsscommerce.com/magento-2-admin-product-preview-plus.html): allows admin to get quick preview of frontend pages from the admin panel.
75+
76+
[Shipping and Payment Method per Customer Group](https://bsscommerce.com/magento2-shipping-and-payment-method-per-customer-group.html): assigns specific shipping and payment methods for each customer group.
77+
78+
[Shopping Cart Price Rules per Store View](https://bsscommerce.com/shopping-cart-price-rule-per-store-view-for-magento-2.html) and [Catalog Price Rules per Store View](https://bsscommerce.com/catalog-price-rule-per-store-view-for-magento-2.html): allows admin to set up different shopping cart rules or catalog rules per store view.
79+
80+
[Tax per Store View](https://bsscommerce.com/tax-per-store-view-for-magento-2.html): sets up different taxes for the same products per store view.

composer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "bsscommerce/module-custom-product-attribute-export",
3+
"description": "Bss Custom Product Attribute Export Modules",
4+
"require": {
5+
"php": "~5.5.0|~5.6.0|~7.0.0"
6+
},
7+
"type": "magento2-module",
8+
"version": "1.0.4",
9+
"license": [
10+
"OSL-3.0",
11+
"AFL-3.0"
12+
],
13+
"suggest": {
14+
"magento/module-cookie": "100.0.*"
15+
},
16+
"autoload": {
17+
"files": [
18+
"registration.php"
19+
],
20+
"psr-4": {
21+
"Bss\\CustomProductAttributeExport\\": ""
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)