What is the intention behind the product_configurator_settings table? - shopware6

I am doing some research about variant handling in Shopware in general and was not able to find any relevant information about the table product_configurator_setting.
When you create a variant, then it is required to add the relevante property option id, the parent id and the variant id so that there will be a relation created.
[
'id' => $variantUuid,
'parentId' => $parentUuid,
'options' => [
[
'id' => $propertyGroupOptionId
]
]
];
However, there was an existing documentation which says, that an entry in the table product_configurator_setting is required. However, when i create variants in the Shopware-Backend, no such entry is created.
"configuratorSettings" => [
[
"productId" => $variantUuid,
"optionId" => $propertyGroupOptionId
]
],
So for clarification:
What is the intention for having the table product_configurator_setting and what is the difference to the options entry for variants?
Isn't the information redundant as it exist for variants?
Why is the entry mandatory in the documentation but it will not be created by Shopware when variants are created in the Admin UI.

The product_configurator_setting table in Shopware is used to map product variants to their corresponding configurator options when creating variants programmatically. This is different from the options array used in the Shopware backend to establish the relationship between a variant and its configurator option(s). While the product_configurator_setting table is mentioned as mandatory in some cases, it is not required when creating variants using the Shopware backend.

Related

Create a PODIO item with relationship with podio api for PHP

How can we create an item and relate it to other items (setting the values on a relationship field)? I found no examples regarding those fields.
Just found how to do it.
1) Get the 'item_id' value for the app item you want to relate to in the parent application.
$item_id = $item->item_id;
2) Use the item_id on the child application relationship field.
new PodioAppItemField(array("external_id" => "my_rel_field", "values" => array( 'item_id' => $item_id)))

Laravel TNTsearch custom index creation and usage for large SQL database table

Here is my situation, context, and dilemma.
Situation
I'm fairly new to Laravel and still learning the ropes. I recently installed TNTSearch and Laravel Scout and was able to create a model index using the below config. I created the index using the console command php artisan tntsearch:import "App\Models\Product" and can fuzzy search successfully with App\Models\Product::search($keyword)->get().
config/scout.php
'tntsearch' => [
'storage' => storage_path() . '/index',
'fuzziness' => 'auto',
'fuzzy' => [
'prefix_length' => 2,
'max_expansions' => 50,
'distance' => 4,
],
'asYouType' => true
],
Context
I have an SQL database table with over 30k+ product records segmented per province (Canadian project), and instead of searching the whole index and later filter by market, I’d like to create one index per market and launch a search for a given market. I believe it will speed up the search and avoid returning results which will later be discarded! So basically having one product index file per province (i.e. products_on.index, products_qc.index, ...)
Dilemma/Issue
I am unable to find how to create such an index, have it update automatically and also how to use it. I scoured the Internet for tutorial/guidance and could only find scarce information I can hardly put together. I’d appreciate if someone could point me in the right direction or guide me on how to implement such a thing.
No answer is wrong, and any bits and pieces of information can help me greatly to “get up to speed.”
EDIT (July 30th, 2018):
I still haven't found the answer to my request but the more I search, the more I'm concluding search indexes are "tied" to a model, and it is not possible to have more than one index per model. So I would have to create one model extension per market from the original Listings model (Listings_QC, Listings_ON, ...). Then create an index per markets and search from those (Listings_QC::search(...)).
I'm not keen to create models based on data! Is this a good approach/practice?
RESOLVED !
My inexperience with Laravel search index in general lead me in the wrong direction!
I finally found a document explaining how to use searchBoolean() to search using "and". Modified my config as below to add the searchBoolean:
'tntsearch' => [
'storage' => storage_path() . '/index',
'fuzziness' => 'auto',
'fuzzy' => [
'prefix_length' => 2,
'max_expansions' => 50,
'distance' => 4,
],
'asYouType' => true,
'searchBoolean' => true
],
Then specify the market using the model's method toSearchableArray(), and add the market to any requested seach keyword.
For example, listing search with 'Alsace' for a QC market, I launch the search as
Listings::search('Alsace QC')->get().
Voilà! May help others hitting the same "wall"!

get some of my controllers in zend framework 2

I am createing a cms based on zend framework 2 . I have som modules , let's say News module.
It has two controllers one for backend and one for front page :
News Module :
-- AdminController
-- IndexController
My question is How can I list all AdminControllers in my admin module ?
I think it can be achieved by event manager but I don't know how
Thanks in advance
Your Admin module does this:
check a config key (i.e. super_cms)
check if a subkey exists (i.e. controllers)
foreach entries in said subkey, list them on your webpage
Your News module does this:
//module.config.php
return [
'super_cms' => [
'controllers' => [
'NewsModule\Controller\AdminController' => [
'label' => 'News',
'permission' => 'Admin',
'route' => 'news/admin'
]
]
]
];
Now with this setup, you could do a foreach on the controllers and create a navigation that has all your controllers listed that you need. You could specify dedicated label options, you could assign permission keys that are required for access or you could assign a dedicated route to call.
This is all up to you tho. But without configuration, nothing works. There are "magic" ways, yes, but they would all require you to recursively scan lots and lots of directories which you don't want! Seriously, you don't!

Authorization::Roles doesn't work in Catalyst app

I've tried use Authorization::Roles in my Catalyst app. Authentication works right but when I use $c->check_user_roles("admin"); it always returns false. What's wrong?
Some config:
store => {
class => 'DBIx::Class',
user_model => 'Mymodel::User',
id_field => 'name',
role_field => 'rolename', # in my table there is the same column
# name undoubtedly
}
If your roles are stored in the users table, use the role_column option. If your roles are stored in a separate table, use the role_relation and role_field options. role_field on its own isn't valid.

Yii - one controller multiple urls

I'm trying to create two Yii models that are very similar and can share the same database table. One is a 'question' and one is an 'article'. They both share a title, body, and author. 'Question' has an additional field in the table that 'article' does not need to interact with called follow_up.
Most methods and validation is the same, but there are some tiny differences that could easily be done with if statements. The main problem I'm seeing is the URL, I want separate URLs like site.com/question and site.com/article but have them both interact with the same model, controller, and views.
How can this be done?
Use the urlManager component in the Yii config to set routes for /article and /question to go to the same controller, and then either use different actions or different parameters to differentiate between the two. Since you said they are almost identical, I would suggest different parameters and a single action as follows:
array(
...
'components' => array(
...
'urlManager' => array(
'question/<\d+:id>' => 'mycontroller/myaction/type/question/id/<id>',
'article/<\d+:id>' => 'mycontroller/myaction/type/article/id/<id>',
),
),
);
Of course you'll have to modify that for your needs, but that's the general setup. Look here for more information: http://www.yiiframework.com/doc/guide/1.1/en/topics.url