The Cart EndPoint allows the user to buy products to the application.

 

1 Usage of a Cart EndPoint

The endPoint of type Cart define the configurations to allow the user to buy products from the application and to realize the needed transactions for that.

Cart EndPoint

The Axional Frontend can work without the EndPoint of type cart, but if this is designed, only one cart endPoint can be defined in the appConfiguration.xml.

 

2 Examples of Cart EndPoint

To create this example of cart endPoint the following SQL Queries have been created.

Copy

SQL Query

<select>
    <columns>
    CAST(NULL AS BLOB) <alias name="image" />, 
    t.*
    </columns>
    <from alias="t">
        <select>
            <columns>
                garticul.codigo <alias name="codart"/>, 
                garticul.nomart, 
                gartiean.codean, 
                gventarl.precio,
                gventarl.dtouni,
                garticul.marca,
                SUM(<nvl>galmstkg.stkbas,0</nvl>) <alias name="stkbas"/>,
                frontend_docl.canped <alias name="_qty" />
            </columns>
            <from table='garticul'>
                <join table='gartvarl'>
                	<on>gartvarl.codart = garticul.codigo</on>
                	<join table='gart_unidefs'>
                		<on>gartvarl.codart = gart_unidefs.codart</on>
                		<on>gartvarl.varlog = gart_unidefs.varlog</on>
                		<join table='gartiean'>
                			<on>gart_unidefs.codart = gartiean.codart</on>
                			<on>gart_unidefs.varlog = gartiean.varlog</on>
                			<on>gart_unidefs.coduni = gartiean.coduni</on>
                		</join>
                		<join table='gventarh'>
                			<on>gventarh.codigo = '2011'</on>
                			<join table='gventarl'>
                			    <on>gventarl.cabid = gventarh.cabid</on>
        	        			<on>gventarl.codart = gart_unidefs.codart</on>
        	        			<on>gventarl.varlog = gart_unidefs.varlog</on>
        	        			<on>gventarl.coduni = gart_unidefs.coduni</on>
        	        			<on>gventarl.precio != 0</on>
        	        		</join>	
                		</join>	
                	</join>
                	<join table='galmstkg' type='left'>
        				<on>gartvarl.codart = galmstkg.codart</on>
        				<on>gartvarl.varlog = galmstkg.varlog</on>
        				<on>galmstkg.cuenta = 'DISP'</on>
        				
        				<join table='galmacen'>
        					<on>galmstkg.codalm = galmacen.codigo</on>
        				</join>	
        			</join>
                </join>
                <join table="frontend_doch" type="left">
                     <join table="frontend_docl">
                        <on>gartvarl.codart = frontend_docl.codart</on>
                        <on>frontend_docl.codalm is null</on>
                        <on>frontend_doch.cabid = frontend_docl.cabid</on>
                        <on>frontend_doch.tercer = ${USER}</on>
                        <on>frontend_doch.cabid = ?</on>
                    </join>
                </join>
            </from>
            <where>
                gartvarl.varlog = '0' AND
                TODAY BETWEEN gventarl.vigini AND gventarl.vigfin AND
                $0
            </where>
            <group>1,2,3,4,5,6,8</group>
            <order>1,4</order>
        </select>
    </from>
</select>
Copy

SQL Query

<select>
    <columns>
        CAST(NULL AS BLOB) <alias name="image" />, 
        t.*
    </columns>
    <from alias="t">
        <select>
            <columns>
                frontend_docl.codart, garticul.nomart,gartiean.codean,
                frontend_docl.codalm, frontend_docl.precio,frontend_docl.dtolin,
                sum(galmstkg.stkbas)  <alias name="stkbas"/>,
                frontend_docl.canped <alias name="_qty" />
            </columns>
            <from table="frontend_docl">
                <join table="frontend_doch">
                    <on>frontend_doch.cabid = frontend_docl.cabid</on>
                    <on>frontend_doch.estado = "O"</on>
                    <on>frontend_doch.tercer = ${USER}</on>
                </join>
                <join table = "garticul">
                    <on>garticul.codigo = frontend_docl.codart</on>
                </join>
                <join table='gartvarl'>
                	<on>gartvarl.codart = garticul.codigo</on>
                	<on> gartvarl.varlog = '0'</on>
                	<join table='gart_unidefs'>
                		<on>gartvarl.codart = gart_unidefs.codart</on>
                		<on>gartvarl.varlog = gart_unidefs.varlog</on>
                		<join table='gartiean'>
                			<on>gart_unidefs.codart = gartiean.codart</on>
                			<on>gart_unidefs.varlog = gartiean.varlog</on>
                			<on>gart_unidefs.coduni = gartiean.coduni</on>
                		</join>
                		<join table='gventarh'>
                			<on>gventarh.codigo = '2011'</on>
                			<join table='gventarl'>
                			    <on>gventarl.cabid = gventarh.cabid</on>
        	        			<on>gventarl.codart = gart_unidefs.codart</on>
        	        			<on>gventarl.varlog = gart_unidefs.varlog</on>
        	        			<on>gventarl.coduni = gart_unidefs.coduni</on>
        	        			<on>gventarl.precio != 0</on>
        	        		</join>	
                		</join>	
                	</join>
                	<join table='galmstkg' type="left">
        				<on>gartvarl.codart = galmstkg.codart</on>
        				<on>gartvarl.varlog = galmstkg.varlog</on>
        				<join table='galmacen'>
        					<on>galmstkg.codalm = galmacen.codigo</on>
        				</join>	
        			</join>
                </join>
            </from>
            <where>
                TODAY BETWEEN gventarl.vigini AND gventarl.vigfin
            </where>
            <group>1,2,3,4,5,6,8</group>
        </select>
    </from>
    <order>t.codart</order>
</select>
Copy

SQL Query

<select>
    <columns>
        frontend_docl.codart,
        garticul.nomart,gartiean.codean,frontend_docl.codalm, 
        frontend_docl.precio, frontend_docl.dtolin, frontend_docl.canped, 
        frontend_docl.impnet
    </columns>
    <from table="frontend_docl">
        <join table="frontend_doch">
            <on>frontend_doch.cabid = frontend_docl.cabid</on>
            <on>frontend_doch.tercer = ${USER}</on>
            <on>frontend_doch.cabid = ?</on>
        </join>
        <join table = "garticul">
            <on>garticul.codigo = frontend_docl.codart</on>
        </join>
        <join table='gartvarl'>
        	<on>gartvarl.codart = garticul.codigo</on>
        	<on> gartvarl.varlog = '0'</on>
        	<join table='gart_unidefs'>
        		<on>gartvarl.codart = gart_unidefs.codart</on>
        		<on>gartvarl.varlog = gart_unidefs.varlog</on>
        		<join table='gartiean'>
        			<on>gart_unidefs.codart = gartiean.codart</on>
        			<on>gart_unidefs.varlog = gartiean.varlog</on>
        			<on>gart_unidefs.coduni = gartiean.coduni</on>
        		</join>
        	</join>
    	</join>
    </from>
    <order>frontend_docl.codart</order>
</select>
Copy

SQL Query

<select>
    <columns>
        frontend_doch.cabid
    </columns>
    <from table="frontend_doch">
    </from>
    <where>
        frontend_doch.estado = "O" AND
        frontend_doch.tercer = ${USER}
    </where>
</select>
Copy

SQL Query

<select>
    <columns>
        frontend_docl.linid
    </columns>
    <from table="frontend_docl">
        <join table="frontend_doch">
            <on>frontend_doch.cabid = frontend_docl.cabid</on>
            <on>frontend_doch.tercer = ${USER}</on>
            <on>frontend_doch.cabid = ?</on>
        </join>
    </from>
    <where>
        $0
    </where>
</select>
Copy

SQL Query

<select>
    <columns>
        frontend_doch.email, frontend_doch.telef1, frontend_doch.codnac, 
        frontend_doch.codprv, frontend_doch.poblac, frontend_doch.codpos, 
        frontend_doch.direcc 
    </columns>
    <from table="frontend_doch">
    </from>
    <where>
        frontend_doch.cabid = ? AND
        frontend_doch.tercer = ${USER}
    </where>
</select>
Copy

SQL Query

<select>
    <columns>
        MAX(orden)+2
    </columns>
    <from table="frontend_docl">
        <join table="frontend_doch">
            <on>frontend_doch.cabid = frontend_docl.cabid</on>
            <on>frontend_doch.estado = "O"</on>
            <on>frontend_doch.tercer = ${USER}</on>
        </join>
    </from>
</select>

And the following SQL transactions has been created too:

 

2.1 Basic Cart EndPoint

Copy

appConfiguration.xml

<endPoints>
    <endPoint type="CART" title="REPLENORDER_ITEM" path="test">
        <cartConfiguration autoLoad="false">
            <pkCols>
                <pkCol>codart</pkCol>                   <!-- codart is the item PK-->
                <pkCol nullable="true">codalm</pkCol>   <!-- Identifies the warehouse from which we are getting the item, nullable because we might don't know it-->
            </pkCols>
            <cartItemSelectors>
                <cartItemSelector title="CINFA">
                    <dataSQL>frontend_cart_item_selector</dataSQL> <!-- SQL Query yo create the page to buy products -->
                </cartItemSelector>
            </cartItemSelectors>
            
            <cartView>frontend_getCartFull</cartView>                              <!-- Select for the cart -->
            <cartSmallView>frontend_getCartCompleted</cartSmallView>                <!-- Select for the small cart -->
            <shippingInfo>frontend_getShippingInfo</shippingInfo>                   <!-- Select to obtain the shipping info-->
            <getExistingCartSerial>frontend_getCartSerial</getExistingCartSerial>   <!-- get the serial of the open cart-->
            <findItemInCart>frontend_searchSerialLineCart</findItemInCart>          <!--search the line of an item in the open cart-->
            <countDistinctItems>frontend_countDistintItemCart</countDistinctItems>  <!-- count the amount of lines in the open cart-->

            <checkoutTransaction>frontend_cart_doch</checkoutTransaction>           <!-- Transaction of the cart-->
            <lineTransaction>frontend_cart_docl</lineTransaction>                   <!-- transaction for the lines-->
        </cartConfiguration>
    </endPoint>
</endPoints>
 

2.1.1 Define the product PK

To define a Cart endPoint, the first step is to decide which params will determine our products. In this example the PK for a product is going to be the codart and the codalm, this one can be null if we don't know the warehouse of the bought product

 

2.1.2 Define the cartItemSelectors

The second step is to define the cartItemSelectors, these are the initial pages where the user can see the list of products he might buy and add them to they cart

SQL Query Requirements

This Select must contain the following columns either in the SQL query and in the Output:

  • codart
  • _qty

 

2.1.3 cartView

The cartView contains the code of the SQL query that will display the table with the cart of the user. This table will be shown in the cart review page and in the Checkout page

SQL Query Requirements

This Select must contain the following columns either in the SQL query and in the Output:

  • codart
  • codalm
  • _qty

Cart Page Checkout Page
 

2.1.4 cartSmallView

The cartSmallView contains the code of the SQL query that will display in the minified cart in some pages, and it is also used for the table that appears under the page where the user can buy products containing a review of the already selected items

SQL Query Requirements

This Select must contain the following columns either in the SQL query and in the Output:

  • codart
  • codalm
  • _qty

Small Cart Page Selected Products Review
 

2.1.5 shippingInfo

The shippingInfo contains the code of the SQL query that will search the questions that the application must do to the user in order to know the user details.

 

2.1.6 getExistingCartSerial

The getExistingCartSerial contains the code of the SQL query that will search the cabid of the user

It will always return one column and one row, with this value. If there is no cart opened for the user, the response will be empty

 

2.1.7 findItemInCart

The findItemInCart contains the code of the SQL query that will search the linid of an item inside the open cart of the user

It will always return one column and one row, with this value. If the item is not inside the cart yet, the response will be empty

 

2.1.8 countDistinctItems

The countDistinctItems is a simple SQL Query that returns the number of lines inside the cart opened of the user

 

2.1.9 checkoutTransaction

The checkoutTransaction is a SQL Query transaction that allows the transactions to the cart header. It needs to have implemented the Insert and Update Transactions

 

2.1.10 lineTransaction

The lineTransaction is a SQL Query transaction that allows the transactions to the lines of the cart. It needs to have implemented the Insert, Update and Delete Transactions