Announcement

Collapse
No announcement yet.

do the Product_Load_xxxx work off id or display order?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • do the Product_Load_xxxx work off id or display order?

    The docs don't say. I need to know if the Product_Load_xxxx work off id or display order?

    <mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Last(product var)" />

    <mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Previous(product var, prev_product var)" />


  • Off the top of my head, Product Load functions need the product id so it can populate the product array, which is likely available by reference.

    My rule of thumb: if the function doesn't include "_code" then the id is needed. Then, if the input parameter has "var" the input is probably an array as in a load function. Not always the case but in this instance, it appears to be an array being passed/returned by reference.

    I don't believe I've seen a function use the display order to retrieve product information.

    Scott
    My T-shirt Collection is mostly MivaCon T-shirts!!
    Interactive Design Solutions
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    http://www.southbound.com
    Competitive Rates, Popular Modules, and Integrations:
    Product Copy | Wholesale Pricing | AutoBaskets

    Comment


    • Here's the source code for those functions from the MMLSK:

      Code:
      <MvFUNCTION NAME = "Product_Load_Last" PARAMETERS = "product var" STANDARDOUTPUTLEVEL = "">
          <MvIF EXPR = "{ NOT [ g.Library_Filename_Native_DBAPI ].DB_OPENVIEW_Range( 'Merchant', 'Products',
                                                                                     'SELECT * FROM ' $ g.Store_Table_Prefix $ 'Products ORDER BY disp_order DESC',
                                                                                     '',
                                                                                     0, 1 ) }">
              <MvFUNCTIONRETURN VALUE = "{  [ g.Library_Filename_Utilities ].Error( 'MER-DBE-PRD-00024', g.MvOPENVIEW_Error ) }">
          </MvIF>
      
          <MvIF EXPR = "{ Products.d.EOF }">
              <MvCLOSEVIEW NAME = "Merchant" VIEW = "Products">
              <MvFUNCTIONRETURN VALUE = "{ Error_Load_EOF( 'MER-DBE-PRD-00053' ) }">
          </MvIF>
      
          <MvEVAL EXPR = "{ Product_Read( l.product ) }">
          <MvCLOSEVIEW NAME = "Merchant" VIEW = "Products">
      
          <MvFUNCTIONRETURN VALUE = 1>
      </MvFUNCTION>
      
      
      <MvFUNCTION NAME = "Product_Load_Previous" PARAMETERS = "product var, prev_product var" STANDARDOUTPUTLEVEL = "">
          <MvASSIGN NAME = "g.Product_Load_Previous_Display_Order"    VALUE = "{ l.product:disp_order }">
      
          <MvIF EXPR = "{ NOT [ g.Library_Filename_Native_DBAPI ].DB_OPENVIEW_Range( 'Merchant', 'Products',
                                                                                     'SELECT * FROM ' $ g.Store_Table_Prefix $ 'Products WHERE disp_order < ? ORDER BY disp_order DESC',
                                                                                     'g.Product_Load_Previous_Display_Order',
                                                                                     0, 1 ) }">
              <MvFUNCTIONRETURN VALUE = "{  [ g.Library_Filename_Utilities ].Error( 'MER-DBE-PRD-00023', g.MvOPENVIEW_Error ) }">
          </MvIF>
      
          <MvIF EXPR = "{ Products.d.EOF }">
              <MvCLOSEVIEW NAME = "Merchant" VIEW = "Products">
              <MvFUNCTIONRETURN VALUE = "{ Error_Load_EOF( 'MER-DBE-PRD-00052' ) }">
          </MvIF>
      
          <MvEVAL EXPR = "{ Product_Read( l.prev_product ) }">
          <MvCLOSEVIEW NAME = "Merchant" VIEW = "Products">
      
          <MvFUNCTIONRETURN VALUE = 1>
      </MvFUNCTION>
      In the case of Product_Load_Last, you're just passing in the name of the variable to which you want the function's return data written. In the case of Product_Load_Previous, the return data is written to the variable specified in the second parameter. I'm not sure how if at all the first parameter is used.
      Justin Sims
      216digital
      Cleveland Area - Code and Design
      https://216digital.com/

      Comment


      • I don't think I've ever used these functions. Looks like, in 'prev' function that the first parameter is the array of the product you want to start from. So, if the product array passed(by reference) has a display order value of 5, and stored in the global, this should return a product array from the table where the display order is 4. If it doesn't exist I assume it would retrieve the product with a display order value of 3, etc.
        My T-shirt Collection is mostly MivaCon T-shirts!!
        Interactive Design Solutions
        MivaMerchant Business Partner | Certified MivaMerchant Web Developer
        http://www.southbound.com
        Competitive Rates, Popular Modules, and Integrations:
        Product Copy | Wholesale Pricing | AutoBaskets

        Comment

        Working...
        X

        This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

        This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

        Accept