1 2 Previous Next 24 Replies Latest reply: Nov 8, 2012 2:00 AM by karthik chopperla RSS

    Blacklisting at product level

    959025
      I need to blacklist a product and the black listed product should not be able to add to Cart. Can anyone guide me on how can i proceed with it?
        • 1. Re: Blacklisting at product level
          RMishra
          in product we may have a property isBlacklisted with true/false and check it before adding item to cart:
          /atg/commerce/catalog/ProductCatalog.xml:
          <gsa-template xml-combine="append">
          <item-descriptor name="product">
          <table name="my_dcs_product" type="auxiliary" id-column-name="product_id">
          <property name="isBlackListed" data-type="boolean" default="false" column-name="isBlackListed" category-resource="categoryAutomatedRecommendations" display-name-resource="disallowAsRecommendation">
          <attribute name="resourceBundle" value="atg.commerce.ProductCatalogTemplateResources"/>
          </property>
          </table>
          </item-descriptor>
          </gsa-template>

          -RMishra

          Edited by: RMishra on Nov 5, 2012 4:21 PM

          Edited by: RMishra on Nov 6, 2012 7:59 PM
          • 2. Re: Blacklisting at product level
            RMishra
            Then start your server->log on to dyn/admin->component Browser->reach /atg/commerce/catalog/ProductCatalog-> go to down in page->left corner there is method generateSQL->click and gererate->find my_dcs_product tables and copy sql code of tables my_dcs_product->->go to admin/JDBC Browser/Execute Query and execute query.
            again restart your server then entry will be reflected.

            -RMishra

            Edited by: RMishra on Nov 6, 2012 7:59 PM

            Edited by: RMishra on Nov 6, 2012 7:59 PM
            • 3. Re: Blacklisting at product level
              karthik chopperla
              Just create an attribute in repository as said by mishra and use that flag to show/not show "Add To Cart" button in productDetail page. I dont think you need to modify AddCommerceItemInfo.

              -karthik
              • 4. Re: Blacklisting at product level
                RMishra
                Hi Karthik, when all properties of all tables of product item-descriptor will be represented as object then all properties should have setters/getters in any class (like commerceItem ect.).
                Can you tell in which class it will be happen for product item descriptor?
                If we don't have setter/getter for new property can we use it in productDisplay page by using cartmodifierformhandler?
                Kindly someone reply.

                Thanks in advance.
                -RMishra
                • 5. Re: Blacklisting at product level
                  karthik chopperla
                  You already have AuxiliaryData in commerceItem class which gives you access to product reference. Reference to product repositoryitem will give access to all product attributes including newly created blacklisted property.

                  From the requirement, we can just use property to display the button.

                  -karthik
                  • 6. Re: Blacklisting at product level
                    RMishra
                    Thanks Karthik. :)
                    -RMishra
                    • 7. Re: Blacklisting at product level
                      959025
                      While im creating a new column( isBlacklisted ) its not getting reflected while querying. Can you please help !
                      • 8. Re: Blacklisting at product level
                        RMishra
                        I have updated in above post. follow above steps.
                        -RMishra
                        • 9. Re: Blacklisting at product level
                          959025
                          Hi Mishra,

                          I am not able to find my_dcs_product while invoking GenerateSQL. Can you please help me.
                          • 10. Re: Blacklisting at product level
                            RMishra
                            After click generateSQL click to Invoke Method button. Then find your table and run in your database that you are using.
                            -RMishra

                            Edited by: RMishra on Nov 7, 2012 5:41 PM
                            • 11. Re: Blacklisting at product level
                              959025
                              There itself I am unable to find the table.
                              • 12. Re: Blacklisting at product level
                                RMishra
                                Can you able to find other tables like dcs_product ect?
                                can you pase here your code here?
                                -RMishra

                                Edited by: RMishra on Nov 7, 2012 6:01 PM
                                • 13. Re: Blacklisting at product level
                                  959025
                                  My atg/commerce/catalog/ProductCatalog.xml:


                                  <?xml version="1.0" encoding="UTF-8"?>
                                  <gsa-template xml-combine="append">
                                       <item-descriptor name="product">
                                            <table name="my_dcs_product" type="auxiliary"
                                                 id-column-name="product_id">
                                                 <property name="isBlackListed" data-type="boolean"
                                                      default="false" column-name="isBlackListed"
                                                      category-resource="categoryAutomatedRecommendations"
                                                      display-name-resource="disallowAsRecommendation">
                                                      <attribute name="resourceBundle"
                                                           value="atg.commerce.ProductCatalogTemplateResources" />
                                                 </property>
                                            </table>
                                       </item-descriptor>
                                  </gsa-template>
                                  • 14. Re: Blacklisting at product level
                                    RMishra
                                    Are you able to show other tables?
                                    -RMishra
                                    1 2 Previous Next