Forums / Developer / Shop Donation / Comment46901

Author Topic

kracker

The Doctor

Friday 26 January 2007 12:17:21 am

Comment46901

When I needed to modify the shop checkout,
similar to way you describe. I found I needed
to modify these files.

kernel/shop/add.php
kernel/shop/ezshopoperationcollection.php

In the file, 'kernel/shop/add.php'
See the contents of the file, <i>Do you see ...</i>

// Check if the object has a price datatype, if not it cannot be used in the basket
$error = $basket->canAddProduct( $object );
if ( $error !== EZ_ERROR_SHOP_OK )
    return $Module->handleError( $error, 'shop' );

In the file, 'kernel/shop/ezshopoperationcollection.php'
See the contents of the function, 'addToBasket', <i>Do you see ...</i>

    function addToBasket( $objectID, $optionList )
    {
        include_once( 'kernel/shop/classes/ezshopfunctions.php' );
                $http =& eZHTTPTool::instance();
        
        $object = eZContentObject::fetch( $objectID );
        $nodeID = $object->attribute( 'main_node_id' );
        $price = 0.0;
        $isVATIncluded = true;
        $attributes = $object->contentObjectAttributes();

        $priceFound = false;

        foreach ( $attributes as $attribute )
        {
            $dataType = $attribute->dataType();
            if ( eZShopFunctions::isProductDatatype( $dataType->isA() ) )
            {
                $priceObj =& $attribute->content();
                $price += $priceObj->attribute( 'price' );
                $priceFound = true;
            }
        }

        if ( !$priceFound )

<i>Do you see ...</i>
This is not a solution. I don't need this atm. Still I have noted this thread for future reference.
This is me telling you your not trying hard enough to find any solutions on your own because
I did this simply by reading the documentation and source code for related keywords.....

Still a user with even marginal skill should be able to see how to pass a form text input variable (user defined price) to the related part of the kernel (above) and use this additional input as the product 'price'.

<i>//kracker
If your not a programmer you may wish to make friends with one ;P

Garbage - The World Is Not Enough</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/