What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hello Techies , Can anyone share spryker command for module create or extend it ?

U03DQ4D8L65
U03DQ4D8L65 Posts: 46 πŸ§‘πŸ»β€πŸš€ - Cadet

Hello Techies , Can anyone share spryker command for module create or extend it ?

Comments

  • Alberto Reyer
    Alberto Reyer Posts: 690 πŸͺ - Explorer

    You can use the new SDK: https://docs.spryker.com/docs/sdk/dev/spryker-sdk.html#getting-started

    spryker-sdk list will show you all available commands and I'm sure there is one to create a new module (spryker-sdk generate:php:add-module)

  • U03DQ4D8L65
    U03DQ4D8L65 Posts: 46 πŸ§‘πŸ»β€πŸš€ - Cadet

    Superb @UL6DGRULR

  • U03DQ4D8L65
    U03DQ4D8L65 Posts: 46 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited August 2022

    @UL6DGRULR One more help needed. I want to add custom attributes(Attribute 1 , Attribute 2) to product by creating new table product_custom_attribute that should associate with product display in front end and back end. How can i do this?

  • Alberto Reyer
    Alberto Reyer Posts: 690 πŸͺ - Explorer

    Please have a read before on product attributes in the documentation.
    There is a difference between attributes (something that is used for displaying or is optional) and properties of a product (something that has a meaning and some part of the code is relying on).

    For attributes you do not need to create a new field or even a new table. Those are saved in spy_product_abstract.attributes (or spy_product.attributes for concretes/articles), respectively in their _localized euqivalent if they should be translatable.
    See https://docs.spryker.com/docs/scos/user/back-office-user-guides/202005.0/catalog/attributes/creating-product-attributes.html for an intro into product attributes.

    If you do want to have a separate DB field, for example because your code relies on the fact that this field is always present, you do not need to create a new table. By creating a new table you will decrease the performance, as per default propel does not fetch relations, but only when they are needed. This means that $productEntity->getPyzCustomAttribute()->getAttribute1() will cause two DB queries.
    Instead you can add columns to existing tables in Spryker: https://docs.spryker.com/docs/scos/dev/back-end-development/zed/persistence-layer/database-schema-definition.html

  • U03DQ4D8L65
    U03DQ4D8L65 Posts: 46 πŸ§‘πŸ»β€πŸš€ - Cadet

    ok Thanks

  • U03DQ4D8L65
    U03DQ4D8L65 Posts: 46 πŸ§‘πŸ»β€πŸš€ - Cadet

    @UL6DGRULR It is very useful

  • U03DQ4D8L65
    U03DQ4D8L65 Posts: 46 πŸ§‘πŸ»β€πŸš€ - Cadet

    @UL6DGRULR How can we add new fields for account profile and Order Details?

  • Alberto Reyer
    Alberto Reyer Posts: 690 πŸͺ - Explorer

    Account = spy_customer:

    Add
    src/Pyz/Zed/Customer/Persistence/Propel/Schema/spy_customer.schema.xml
    with

    <?xml version="1.0"?>
    <database xmlns="spryker:schema-01" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>"
              name="zed"
              xsi:schemaLocation="spryker:schema-01 <https://static.spryker.com/schema-01.xsd>"
              namespace="Orm\Zed\Customer\Persistence"
              package="src.Orm.Zed.Customer.Persistence">
    
        <table name="spy_customer">
            <column name="your_column" type="COLUMN TYPE" />
        </table>
    </database>
    

    and run console propel:install to create the field in the DB and in the entity.

    This is all part of the bootcamp (https://academy.spryker.com/learn/course/external/view/elearning/89/developer-bootcamp) if you haven't already gone through I would strongly advice you to do so.

  • Alberto Reyer
    Alberto Reyer Posts: 690 πŸͺ - Explorer

    Order Details = spy_sales_order

  • U03DQ4D8L65
    U03DQ4D8L65 Posts: 46 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ok Thanks

  • U03DBF2H9DY
    U03DBF2H9DY Posts: 61 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited August 2022

    We are facing this issue when run console propel:install command. After creating Schema for extend customer table..

  • U03DQ4D8L65
    U03DQ4D8L65 Posts: 46 πŸ§‘πŸ»β€πŸš€ - Cadet

    @UL6DGRULR If i want to add two field - One String Value , Second - hashmap then can we do it?