Shopware 6 custom product fields in tabs - symfony

I am completely new to the the Shopware (6) community and I am still learning how to code in Symfony and Vue.js.
After trying some how to's in the developer wiki, I wanted to try some coding by myself.
I would like to combine https://docs.shopware.com/en/shopware-platform-dev-en/how-to/add-admin-new-field and https://docs.shopware.com/en/shopware-platform-dev-en/how-to/new-tab-admin?category=shopware-platform-dev-en/how-to into one functionallity (Product tabs with custom admin fields).
However, when I use the v-model attribute into an input field, the complete tab will turn white and the following error is outputted in the console: product is not defined.
My guess is that the model needs to be imported into the module (I can't find this anywhere into the docs).
Can someone tell me what I have to do to make this work? My current source code can be found here: https://github.com/Millerdigital-matthew/miller-product-upsells

As I understand, you need to change your index.js as follows:
const { Component } = Shopware;
const { mapState } = Component.getComponentHelper();
Component.register('...', {
computed: {
...mapState('swProductDetail', [
'product'
]),
}
});

I looked into your current code.
In your extension you try to bind
v-model="product.manufacturerId"
But in the block you are extending, there is no product defined.
So the solution to this problem, is to define product on your
view/sw-product-detail-upsells

Related

How can I use 'selectedPanel` in storybook?

I noticed a property in Storybooks Options Docs called selectedPanel which I assume will allow me to pre-select an addon panel.
I'm unclear on how to use it. The example is:
options: { selectedPanel: 'storybook/a11y/panel' }
What I don't understand is where the 'storybook/a11y/panel' string comes from. What if I want to preselect the 'Source' panel?
For anyone looking to default to the knobs panel: selectedPanel: 'storybookjs/knobs/panel' appears to work!
I've encountered the same issue and managed to find out that the panelId can at least be found in the addon's register source code step. For example, I wanted to open Readme tab for certain stories.
I ended up finding the id of the panel in registerWithPanelTitle.js, and then using it with the storiesOf API like this:
.addParameters({
options: { selectedPanel: 'REACT_STORYBOOK/readme/panel' },
})
For a11y, it can be found in constants.ts.
Although, I've searched for those in the distributed node_modules versions in my case.
P.S. If you want to reorder the panels for all of the stories globally, the list that the addons are imported in handles it.
I was using the #storybook/addons-essential in main.js and simply added #storybook/addon-controls to the front of the addons array option, like so:
module.exports = {
addons: ['#storybook/addon-controls', '#storybook/addon-essentials'],
...
}
This puts the controls tab first, which is auto-selected.

How can I use the Envato Market API to export a list of WordPress plugins?

I'd like to use the Envato API to download a list of plugins for WordPress available on Code Canyon. However I have been unable to find a way to do so.
For example, I tried to use a get /search/item per their documentation using the parameter category and setting it to "wordpress" however this returned a number of results but nowhere near the 6,040 the site says it has.
The document also mentions the "category code" is what I should be entering as the parameter for "category" but it never defines the category code - unfortunately, this seems common throughout the documentation - there isn't any definition. Another example of this is calling get /catalog/collection. The parameter required is "id" which it describes as "The numeric ID of the collection to return" - but what numeric ID? This one wasn't hard to figure out, if you open a collection the url looks like:
https://codecanyon.net/collections/4945814-about
And the numeric portion is the ID...but I sure could wish for more definitions or examples of what the parameters should look like. :-)
I looked around, but didn't find anything helpful on the web nor does there appear to be a forum hosted by Envato for discussing the API.
Any help is appreciated!
Please find the code which I did to fetch data from envato API :
var themeforest_api="http://marketplace.envato.com/api/v2/new-files:themeforest,wordpress.json";
$.getJSON( themeforest_api, {
format: "json"
}).done(function( data ) {
var html='';
$.each( data['new-files'], function( i, item ) {
html=html+'<li><img src="'+item.thumbnail+'"></li>';
if ( i === 8 ) {
return false;
}
});
$("#all_items").append( html );
});
Hope it will help you for your one too.

SuiteScript 2.0 Intellisense create search filter

I'm just starting out with suitescript, and I was wondering how to get the intellisense to work in suitescript 2.0 on creating a saved search.
I know this is easy to do on the netsuite UI but I would like to learn how to do it in Suitescript. Here is example code below. I'm trying to use ctrl + space to show options on the Customer type. I've tried adding ['N/record'] and it gave me options on records.Type.(here were the options) but I can't get it to give me anything inside the filter single quotes.
define(['N/search'],
function(search) {
var MYsearch = search.create({
type: search.Type.CUSTOMER,
title: 'My Customer search',
filters: ['', '', ''] // here is where i want intellisense
})
as a side question: Does anyone know a good place for suitescript 2.0 questions and answers? stackoverflow seems to be lacking. I'm assuming because it's pretty much brand new.
(I know of all the tutorials on the help center and SuiteAnswers)
Thanks for the help!
UPDATE: It looks like Netsuite 2.0 doesn't like Internal IDs... hope that helps.
I usually just create an array for filters, and another for columns, then add my filters to that array like sovar arrFilters = [];
arrFilters.push(search.createFilter({
name: 'mainline',
operator: search.Operator.IS,
values: ['F']
}));
arrFilters.push(search.createFilter({
name: 'trandate',
operator: search.Operator.WITHIN,
values: 'lastMonth',
}));
var arrColumns = [];
// invoiceid
arrColumns.push(search.createColumn({
name: 'internalid',
join: 'appliedtotransaction'
}));
Then you can just use your
search.create({
type: search.Type.VENDOR_PAYMENT,
filters: arrFilters,
columns: arrColumns
});
Hope this helps.
Download the latest SuiteCloud Developer IDE or the Eclipse Mars version (just make sure you have downloaded SuiteCloud plugin SuiteCloud IDE - http://system.netsuite.com/download/ide/update_e4). With this IDE, you will be able to have API code assist for SuiteScript 1.0. However, there is other setup to enable it for SuiteScript 2.0. Also, this will enable you to have intellesense for native fields.
Then if you want to include custom fields/columns, setup your master password at main menu >Netsuite>Master Password>.
Get the list of your accounts from the production, sandbox, and beta environment. Do this at main menu >Netsuite>Manage Account>. If you will be added to a new customer account later, you need to add it manually by doing this step again to reflect it.
Now, you need to connect your project folder to NetSuite account. But first, check the project setting by right clicking to the project folder>NetSuite>Change Project Settings>. Then, make sure you will be using the correct account.
Then log-in to the account by right clicking the project folder >NetSuite>Log in to Project Account>. Once successfully logged-in.
Finally, right click again the project folder >NetSuite>Sync Script IDs from Account>. Follow the instructions and select record type and fields.

How do I CC someone when an order is placed?

I am using Ubercart with Drupal.
How do I CC someone when an order is placed? I will probably have to modify the code somewhere because it should only happen under a certain theme, but I'm not sure where to even edit this.
I went to admin/store/ca and created an action. I used the products as a condition and it works.
An easy solution is to use the hook_mail_alter() in a small stub module.
This hook will let you add add to the email generated by another module.
You will need to dig into the ubercart code to find the specific $mailkey for the email you want to change.
http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_mail_alter/6
function myhack_mail_alter(&$message)
{
if ($message['id'] == 'the ubercart mail key')
{
//$message['headers']['Bcc'] = 'myemail#example.com';
$message['headers']['cc'] = 'myemail#example.com';
}
}
One way to find the message key is to add the following to your function, then have the site send the email. This function will dump the keys to the dblog.
watchdog('MailKey', $message['id'], {}, WATCHDOG_INFO);

Drupal Panel Pages Pathauto

I have a Panel Page set up with the path node/%node/foo and all works fine when I visit a link such as node/6/foo. However, when I visit nodealias/foo it doesn't work at all. Is it possible to get panels to work with pathauto in this way?
I am thinking I may have to implement the hook hook_url_inbound_alter and change the url myself.
I also posted a support request in the panels module here: http://drupal.org/node/1219796
As Alexey answers panels doesn't care about aliases, it only sees node/%nid
Here's a good explanation that is valid still for D7:
http://drupal.org/node/211338
To summarize and bring it up to date for D7:
Export your variant for the panel you've created and import it into the panel that overrides the default node display in Drupal.
Add Criterias to the variant so the Panel/variant is only used for the type(s) of content you want to display with this variant.
Voila :) (read the discussion at the link, else the summary will be difficult to understand)
Hope this helps - I myself have spend some time googling and trying to understand this, and I was also confused by the fact that Views DOES care about aliases...
I fixed this using the following code, you would need to alter the pattern to match the pattern of your url aliases and alter the function name to match your module's name.
function brooklands_url_inbound_alter(&$path, $original_path, $path_language) {
$pattern = '#^works\/[A-Za-z0-9]+(-[A-Za-z0-9]+)*\/images(\/\d+)?$#';
if(preg_match($pattern, $original_path)) {
$snip = substr($original_path, 0, strrpos($original_path, '/images'));
$system_path = drupal_lookup_path('source', $snip);
if($system_path) {
$tail = substr($original_path, strrpos($original_path, '/images'));
$path = $system_path . $tail;
}
}
}
You can use this module Subpathauto
it automatically makes the alias to work with subpaths, such as: nodealias/foo
The nodealias is the full alias of your node with nid=6. The third argument (foo) is added through hook_menu() by panels module to the exact alias (node/%nid/%anythingelse) and it is NOT applied to your aliased URL, so you can not use nodealias/foo url to access your panel just because it is not 'hooked' by panels module.
Changing url manually is a good idea, I think.

Resources