Magento2: Create new product type same as bundle - bundle

I want to create new product type in magento2 based on bundle product. I should be able to add bundle items for the parent product as we do for bundle product.
Any help would be appreciable. Thanks.

Related

Not required field url in banners kentico 9

How to make a not required url field in banners or it is impossible?
Kentico 9
The easy part is adding the field. The hard part is modifying the code files to accommodate that new field. The Banner management module is sealed so you'd need to unseal that module via a database query and add the field to the Banners class in the "Banner management" module.
select ClassResourceID, *
from cms_class
where classname = 'cms.banner'
select *
from cms_resource
where resourceid = 271 -- resource id from above query
update cms_resource
set ShowInDevelopment = 1
where resourceid = 271 -- resource id from first query
Clear your cache and reload the modules and you should be able to add a field to the Banner module class.
Next, you will need to go through the code files, which you can find in the /CMSModules/BannerManagement directory, and make modifications where needed so that new field is accessible on your forms and other places.
Lastly, you will have to review any web parts and update them as well with the new field (if needed).
DISCLAIMER - Modifying base Kentico code files is not recommended or supported at all.

Sitecore add new Version for large number of items

I have a very large number of items that have versions on only 'en' language.
I have to create 'de' versions for all these items. (switching the language to 'de' in content editor and clicking 'add new version' and thats all, nothing to translate). The items are children of a common parent and it applies to all the children of that parent root item.
what would be the most practical way to do this task?
There is a challenge in this issue. I have access to only sitecore content editor with admin user. I cant program a script and run it on the system.
You would do something like this:
var master = Sitecore.Configuration.Factory.GetDatabase("master");
// Get the root folder of the items you want to create versions for.
var root = master.GetItem("path_or_GUID_to_root_item");
// Switch to the language you want to create versions for.
using (new LanguageSwitcher("de"))
{
// Loop through all descendants.
foreach (Item descendant root.Axes.GetDescendants())
{
// Create new version using the current context language.
var version = descendant.Versions.AddVersion();
// Lines below are optional if you want to add field values to the version.
version.Editing.BeginEdit();
version.Fields["field_name_or_GUID"] = "value";
version.Editing.EndEdit();
}
}
Bare in mind that Axes.GetDescendants() is not very performance-friendly if you have many items.
So if you're serious about it, use the ContentSearch API to retrieve the items.
But at least you get the idea on how to add a new version for a specific language.
There is a module called ItemVersioner in the Sitecore Marketplace. WIth this module you can create item versions of all available languages with one click. This has two drawbacks:
You have to click on every item and click another time to add the versions. If your tasks is a one time task, it's maybe a solution anyway.
It creates versions for all languages configured under /sitecore/system/Languages. If you have other versions than "en" and "de", you may have to delete them temporary if you don't want to create these versions too.
If this is not a solution, I think you must create some custom code. I think the code from Ruud van Falier is ok to start from. You need to create this code on your local machine and if this works for you, you can create a Sitecore package with this code (have a look on the SDN here for informations about how to create a package). You can then install this package on your system and start the code (you may also create a new ribbon which executes the code to create versions, check this thread for a starting point).
If you really have no content to translate and you only want to display the en version of an item for de when it does not exist then you should consider using the Language Fallback Module, this is exactly what the module is designed to do.
If later you need to add de versions of items then you can do that on a case by case basis as the content gets added.
Please use below URL to solve it -
http://www.cognifide.com/blogs/sitecore/quickly-create-new-language-versions-on-your-sitecore-cms/
http://blog.boro2g.co.uk/create-a-version-of-an-item-in-all-languages-in-the-sitecore-client/

How to Change MVC Registered Bundle Collection items Dynamically

I wish if i could change registered bundle collection items (JS or CSS files) dynamically after my MVC website published for example by hitting a button. Is it possible and what should we do to achieve this?
any help appreciated.
After some search and try i found a way. I put this snippet in Session_Start but you can use it any where for example in button submit handler. I search for Bundle with a special name, then remove and create a new bundle with that name that i used in my project. (I did it to have new fresh bundle because i can't find any method to remove files from existing bundle and i appreciate if anyone knows how to do) Finally add files to bundle with include method of bundle and add bundle to BundleTable. (You could use IncludeDirectory method too)
Bundle bndl = BundleTable.Bundles.GetBundleFor("~/Content/css");
if (bndl != null)
{
BundleTable.Bundles.Remove(bndl);
}
Bundle bndl2 = new Bundle("~/Content/css");
bndl2.Include("~/Content/site.css", "~/Content/secondStyles.css", ... );
BundleTable.Bundles.Add(bndl2);
At the last it's useful to read this article for working with bundles.
Asp.net MVC 4 performance optimization with bundling and minification
Additional answers appreciated.
Good Luck.

Why are my Orchard CMS widgets not populating the Id property when I export them through with Import/Export module?

When I export my Orchard CMS site, most content items have an Id property that is populated with a unique string.
For example, an Html widget may export like this:
<HtmlWidget Id="/Identifier=c1bc3509bc7144f28b5797f24522b7b1" Status="Published">
However, all of the widgets that I have created in my modules are being exported similarly to:
<MyWidget Id="" Status="Published">
Why are my widgets not being exported with an Id? Do I need to do something to set an Id? What am I doing wrong?
Additionally- when I import my recipe, the items that get exported without an Id do not import unless I manually edit each of them in the recipe to have a unique Id. And even then- once I manually add a unique Id, the import tool does not appear to be able to recognise these items and will therefore create the items again; resulting in duplicate widgets.
Turns out that I needed to add the IdentityPart to be attached to my widgets. You can do this in your migrations file by using
ContentDefinitionManager.AlterTypeDefinition("MyWidget",
cfg => cfg
.WithPart("IdentityPart"));

Bundle ID and SKU number

I'm adding an iOS App to iTunes Connect, but are confused regarding the two values Bundle ID and SKU Number which I have to chose for my App.
When I create a new iOS project in Xcode, lets say "MyProject", it's iOS Application Identifier would be com.mycompany.MyProject. Should the iOS Application Identifier be all lower case or what are the "guidelines"? E.g. com.MyCompany.MyApplication, com.mycompany.MyApplication or com.mycompany.myapplication? What are the guidelines regarding this?
Should this iOS Application ID in Xcode be equal to the Bundle ID in iTunes Connect and iOS Provisioning Portal?
Could someone give me an example of, what the SKU Number could look like?
SKU number is anything you'd like, for instance if your app name is "MyApp" you can use SKU "myAppV1" or anything like that. So any value is acceptable.
For App ID you need to create an App ID in the ios dev center and choose it from the drop list of iTunesConnect. Then create an AppStore provisioning profile, copy it's bundle id text and replace the one in your target's info pane under the Bundle ID section. This one is case insensitive, so no problem using com.MyCompany.MyApplication.

Resources