Jump to content

Path Error


MSwanson

Recommended Posts

Hello everyone...

I hope I can find some help.  I have tried to get support from the company that provided the software, but they haven't exactly been helpful. 

We have a Digishop shopping cart, and our paths aren't working.  When you click on an item, we would expect that it goes to www.foxvalleycheesecake.com/store/cart.php?command, but, instead, it just goes to www.foxvalleycheesecake.com/?command. 

I am not familiar with PHP very much at all but it seems to be set up correctly.  In the cart.php file, it reads:

$config->getValue('merchantURL') . '/cart.php?' . CMD_PARAM .

Which I think means it should take the "merchantURL" and add "/cart.php?" and then the command.  In the settings file, the merchantURL="http://www.foxvalleycheesecake.com/store".

I am using PHP 4.4.4.  If you need other information, it can be found at foxvalleycheesecake.com/test.php.

The site was formerly on an Apache server and worked fine.  We copied everything over to our new IIS server, and changed the host paths from /var/www/... to C:\Inetpub\wwwroot.

Is this an issue with the PHP files, our server configuration, or a bug?

Any help you can provide would be greatly appreciated!  Please help, we are getting desperate!

---------------------------------

The cart.php file is:

[code]<?php

require_once('conf/paths.inc.php');

if (!TEST_MODE) {
    require_once('lib/error.prepend.inc.php');
}

require_once('lib/custom.lib.php');
require_once('lib/framework/Session.class.php');
require_once('lib/framework/keywords/KeywordUtil.class.php');
require_once('lib/keywords/DigiSHOPKeyword.class.php');

// TODO this is old stuff to be refactored
$db = new Custom;
$db->connectMySQL();
$refer = getenv('HTTP_REFERER');

define('VIEW_CART_URL', SELF . '?' . CMD_PARAM . '=' . VIEW_CART_CMD);
define('UPDATE_CART_URL', SELF . '?' . CMD_PARAM . '=' . CART_UPDATE_CMD);
define('STORE_MAIN_URL', SELF);


$cmd = $request->getParameter(CMD_PARAM);



// TODO this is here because currently there's no centralized hand-off to secure.
//      has the disadvantage of not being very efficient, but thems the breaks.
if ($keyword = KeywordUtil::getKeywordSessionIdentifier()) {
    $session =& Session::getInstance();
    $session->setAttribute('keyword', $keyword);
}


if (ADD_TO_CART_CMD == $cmd) {
    $cart =& Cart::getInstance();
    Util::checkNumeric($request->getParameter('quantity'));
    Util::checkNumeric($request->getParameter('oID'));
    Util::checkNumeric($request->getParameter('oID'));
    $quantity = $request->getParameter('quantity');
    $productId = $request->getParameter('productID');
    $optionId = $request->getParameter('oID');

    $cart->addItem($productId, $quantity, $optionId);

    $go = (!$config->getValue('cartAddURL')) ? $config->getValue('merchantURL') . '/cart.php' : $config->getValue('cartAddURL');
    $url = ('send' == $config->getValue('cartAddAction')) ? $go : $config->getValue('merchantURL') . '/cart.php?' . CMD_PARAM . '=' . VIEW_CART_CMD;
    $url = ('refer' == $config->getValue('cartAddAction')) ? $db->removeMsg($refer) . '&msg=' . urlencode('Item Added To Your Cart') : $url;
    $db->jump2($url);
    exit;

} elseif (CART_REMOVE_ITEM_CMD == $cmd && $request->getParameter('cID')) {

    Util::checkNumeric($request->getParameter('cID'));
    $cart =& Cart::getInstance();
    $cart->deleteItem($request->getParameter('cID'));
    $url = $config->getValue('merchantURL') . '/cart.php?' . CMD_PARAM . '=' . VIEW_CART_CMD;
    $db->jump2($url);

} elseif (CART_UPDATE_CMD == $cmd) {

    // These can be arrays. do better checking.
    //Util::checkNumeric($request->getParameter('itemId'));
    //Util::checkNumeric($request->getParameter('quantity'));


    if (null != $request->getParameter('itemId')) {
        $cart =& Cart::getInstance();

        $quantities = $request->getParameter('quantity');
        foreach ($request->getParameter('itemId') as $index => $id) {
            $cart->updateItemQuantity($id, $quantities[$index]);
        }
    }

    $url = ($request->getParameter('go')) ? $request->getParameter('go') : VIEW_CART_URL;
    $db->jump2($url);

} elseif (CART_EMPTY_CMD == $cmd) {

    $cart =& Cart::getInstance();
    $cart->emptyCart();

    $url = ($request->getParameter('go')) ? $request->getParameter('go') : VIEW_CART_URL;
    $db->jump2($url);

} elseif (CUSTOMER_ACCOUNT_CMD == $cmd) {

    $url = $config->getValue('merchantURL') . '/account.php';
    $db->jump2($url);

} elseif (CART_CHECKOUT_CMD == $cmd) {

    $cart =& Cart::getInstance();
    $allowNegativeInventory = INVENTORY_DEPLETED_ACTION_DISPLAY == $config->getValue('invOutAction');

    // TODO replace this w MVC for model chaining.
    if ($cart->getSubtotal() < $config->getValue('minOrderAmt')) {
        require_once('lib/framework/MoneyFormat.class.php');

        $view['title'] = 'Subtotal Below Minimum';
        $title = $view['title'];

        include('templates/header.tem.php');
        include('templates/cart.amount.min.tem.php');
        include('templates/footer.tem.php');
        exit;
    } elseif (!$allowNegativeInventory && ($cart->requestedMoreThanInStock() || $cart->hasOutOfStockItems())) {
        $go = VIEW_CART_URL;
    } elseif (!$config->getBoolValue('customerLogin')) {
        $session =& Session::getInstance();
        $go = CHECKOUT_BILLING_URL . '?' . COOKIE_CUSTOMER_ID . '=' . $request->getCookie(COOKIE_CUSTOMER_ID) . '&h=1&s=' . $session->getId();
    } else {
        $go = LOGIN_URL;
    }

    $request->setParameter('go', $go);
    $request->setParameter(CMD_PARAM, CART_UPDATE_CMD);
    include(__FILE__);
    exit;

} elseif ('order_history' == $cmd) {

  $url = $config->getValue('merchantURL') . '/account.php?m=order_history';
  $db->jump2($url);

} elseif (CART_CORRECT_PROBLEMS_CMD == $cmd) {

    $cart =& Cart::getInstance();
    $cart->removeOutOfStockItems();
    $cart->reduceQuantitiesToInventoryLevel();

    $db->jump2(VIEW_CART_URL);

} elseif (VIEW_CART_CMD == $cmd) {

    require_once('lib/framework/Util.class.php');

    $cart =& Cart::getInstance();
    $cartItems = $cart->getItems();

    header(Util::noCacheHeader());

    $continueShoppingURL = ($config->getValue('continueShoppingURL') && ('http://' != $config->getValue('continueShoppingURL'))) ? $config->getValue('continueShoppingURL') : $config->getValue('merchantURL').'/cart.php';
    $allowNegativeInventory = INVENTORY_DEPLETED_ACTION_DISPLAY == $config->getValue('invOutAction');


    if (0 < count($cartItems)) {
        require_once('lib/framework/MoneyFormat.class.php');

        if (!$allowNegativeInventory && ($cart->requestedMoreThanInStock() || $cart->hasOutOfStockItems())) {
            require_once('lib/framework/SimpleConfig.class.php');
            require_once('lib/constants.errors.inc.php');
            $errors = ErrorConfig::getInstance();

            if ($cart->hasOutOfStockItems()) {
                $view['errors'][] = $errors->getValue(PRODUCTS_OUT_OF_STOCK_ERR);
            }

            if ($cart->requestedMoreThanInStock()) {
                $view['errors'][] .= $errors->getValue(MORE_DESIRED_THAN_IN_STOCK_ERR);
            }
        }

        $view['title'] = 'View Cart';

        include('templates/header.tem.php');
        include('templates/view.cart.tem.php');
        include('templates/footer.tem.php');
    } else {
        $view['title'] = 'Cart Empty';
        include('templates/header.tem.php');
        include('templates/no.items.tem.php');
        include('templates/footer.tem.php');
    }

    exit;

} elseif ('search' == $cmd) {
    $view['title'] = 'Search';

    include('templates/header.tem.php');
    include('templates/search.form.tem.php');
    include('templates/footer.tem.php');
    exit;

} elseif ('search_results' == $cmd && $request->getParameter('search')) {

    require_once('lib/framework/Util.class.php');
    require_once('lib/ProductView.class.php');
    require_once('lib/Product.class.php');
    require_once('lib/framework/core/PagedArray.class.php');
    require_once('lib/framework/core/QueryIterator.class.php');
    require_once('lib/ViewHelper.class.php');
    require_once('lib/StoreDAO.class.php');

    $dao = new StoreDAO();
    if ($searchResults = $dao->getSearchResultsList(urldecode($request->getParameter('search')))) {
        $dataStructure = new PagedArray($searchResults, $config->getValue('limit'));
        Util::checkNumeric($request->getParameter('pageNumber'));
        $thisPage = $dataStructure->getPage($request->getParameter('pageNumber'));
        $products = $thisPage->getAllRows();

        // TODO this is a work-around to work with the old stuff on the product template.
        $db->begin = $thisPage->getFirst();
        $db->end = $thisPage->getLast();
        $db->count = $dataStructure->getRowCount();
        $db->page = $db->nextLinks($config->getValue('limit'));
        // end work-around
    } else {
        $page['message'] = 'No items matched your search terms.';
    }

    $page['searchTerm'] = 'Search Term: <b>' . $request->getParameter('search') . '</b><br/>';
    $view['title'] = 'Search Results';



    header(Util::noCacheHeader());
    include('templates/header.tem.php');
    include('templates/' . ViewHelper::getProductListTemplate());
    include('templates/footer.tem.php');
    exit;

} elseif (PRODUCT_DETAIL_CMD == $cmd && $request->getParameter('p')) {

    require_once('lib/framework/Util.class.php');
    require_once('lib/ProductView.class.php');

    header(Util::noCacheHeader());

    // TODO replace this with Product
    Util::checkNumeric($request->getParameter('p'));
    $productId = intval($request->getParameter('p'));
    //if (!is_numeric($productId)) {
    //    require_once('lib/framework/Exception.class.php');
    //    require_once('lib/constants.errors.inc.php');
    //    Exception::throw(SELECT_VALID_PRODUCT_ERR);
    //}

    require_once('lib/framework/Util.class.php');
    require_once('lib/ProductView.class.php');
    require_once('lib/Product.class.php');

    $product = new Product($productId);

    // Check whether product should be displayed at all
    if (!$product->canDisplay()) {
        $url = $config->getValue('merchantURL') . '/cart.php';
        Util::jump($url);
        exit;
    }

    // Could replace this with a static array as part of the product class
    if ($relatedProductId = $product->getRelatedProduct()) {
        $relatedProduct = new Product($relatedProductId);
        if ($relatedProduct->isAvailable()) {
            $product->setRelatedProduct($relatedProduct);
        } else {
            $product->setRelatedProduct(null);
        }
    }

    $title = $product->getName();
    $view['title'] = $title;
    $view['metaTitle'] = $product->getMetaTitle();
    $view['metaDescription'] = $product->getMetaDescription();
    $view['metaKeywords'] = $product->getMetaKeywords();

    header(Util::noCacheHeader());
    include('templates/header.tem.php');
    include('templates/product.detail.tem.php');
    include('templates/footer.tem.php');
    exit;

} elseif (CART_INITIALIZE_LINK_CMD == $cmd) {

    require_once('lib/keywords/DsKywrdEvntHndlr.class.php');

    $session =& Session::getInstance();

    $keyword = new DigiSHOPKeyword($request->getParameter('ad'), $request->getParameter('adsrc'));
    $session->setAttribute('keyword', $keyword);
    KeywordUtil::setKeywordSessionIdentifier($keyword);

    DigiSHOPKeywordEventHandler::triggerEvent(CLICK_EVENT, $keyword);

    $url = SELF;
    $db->jump2($url);
    exit;

} elseif (AFFILIATE_GO_CMD == $cmd && $config->getBoolValue('affiliateProgram')) {
    //Util::checkNumeric($request->getParameter(AFFILIATE_ID_FIELD));
    if ($affiliateId = $request->getParameter(AFFILIATE_ID_FIELD)) {
        $session =& Session::getInstance();
        $session->setAttribute(SESSION_AFFILIATE_ID, $affiliateId);
    }

    if ($request->getParameter('go')) {
        $parameters = $request->getParameters();
        $goTrue = false;
        foreach ($parameters as $key => $value) {
            if ($goTrue) {
                $url .= "&$key=$value";
            }

            if ('go' == $key) {
                $url .= $value;
                $goTrue = true;
            }
        }
    } else {
        $url = SELF;
    }

    $db->jump2($url);

    exit;
} elseif (PRODUCT_LIST_CMD == $cmd && $request->getParameter('c')) {

    // TODO  this whole thing needs to be straightened out
    // TODO reconcile this with the search results. Both need to filter through the same
    //      section. get the results, then send it to model which displays results, regardless
    //      of where they came from. right now there's just a lot of duplicated functionality


    require_once('lib/framework/Util.class.php');
    require_once('lib/framework/MoneyFormat.class.php');

    header(Util::noCacheHeader());
    Util::checkNumeric($request->getParameter('c'));
    $category = new dsCategory($request->getParameter('c'));
    $title = $category->getCategoryCrumbTrail($request->getParameter('c'));

    $view['title'] = $title;
    $view['metaTitle'] = $category->metaTitle;
    $view['metaDescription'] = $category->metaDescription;
    $view['metaKeywords'] = $category->metaKeywords;

    // TODO this needs some SERIOUS work.

    // display subcats if there are some
    Util::checkNumeric($request->getParameter('c'));
    Util::checkNumeric($request->getParameter('pageNumber'));
    if ($category->hasDisplayableSubcats($request->getParameter('c'))) {
        include('templates/header.tem.php');
        if ('grid' == $config->getValue('catListType')) {
            $result = $category->getCategoryGrid($request->getParameter('pageNumber'), $request->getParameter('c'));
            $array = $result['result'];
            $rows = $result['rows'];
            include('templates/category.grid.tem.php');
            include('templates/footer.tem.php');
            exit;
        } else {
            // TODO this is where we get the subcategories.
            $array = $category->getCategoryList($request->getParameter('pageNumber'), $request->getParameter('c'));
            include('templates/category.list.tem.php');
            include('templates/footer.tem.php');
            exit;
        }
    } else {
        include('templates/header.tem.php');
    }

    $result2 = $category->getProductList($request->getParameter('c'), $request->getParameter('pageNumber'));

    if ($result2['rows'] <= 0) {
        $db->page = null;
        //require_once('lib/framework/Exception.class.php');
        //require_once('lib/constants.errors.inc.php');
        //Exception::throw(NO_PRODUCTS_IN_CATEGORY_ERR);
    }

    require_once('lib/ProductView.class.php');
    require_once('lib/ViewHelper.class.php');
    $products = $result2['result'];
    $prows = $result2['rows'];

    if (!$template) {
        $template = ViewHelper::getProductListTemplate();
    }

    include('templates/' . $template);
    include('templates/footer.tem.php');
    exit;

} else {

    require_once('lib/framework/Util.class.php');
    header(Util::noCacheHeader());

    // TODO this is sort of a work-around.
    $category = new dsCategory();
    $title = $view['title'] = $category->getCategoryCrumbTrail();
    $cat = new dsCategory;

    if ('grid' == $config->getValue('catListType')) {
        // TODO huh?
        //$result = $cat->getCategoryGrid();
        $result = $cat->getCategoryGrid($request->getParameter('pageNumber'));
        $array = $result['result'];
        $rows = $result['rows'];
        include('templates/header.tem.php');
        include('templates/category.grid.tem.php');
        include('templates/footer.tem.php');
        exit;
    } else {
        $array = $cat->getCategoryList($request->getParameter('pageNumber'));
        include('templates/header.tem.php');
        include('templates/category.list.tem.php');
        include('templates/footer.tem.php');
        exit;
    }
}

?>[/code]

------------------------------

The config.app.settings.ini.php file is:

[code]<?php die ?>

;DO NOT EDIT THIS FILE--CHANGE THE SETTINGS IN ADMIN AREA

adminLimit="40"
affiliateDefaultCommission="8"
affiliateProgram="N"
affiliateSelfRegistration="FALSE"
approvedDefault="Y"
balanceReportMargin="500"
cartAddAction="view"
cartAddURL=""
categoryCounts="FALSE"
categoryDepth="10"
categoryIMGpath="C:/Inetpub/wwwroot/store/images/categories"
categoryIMGurl="images/category"
catListType="thumbs"
checkout="offline"
contactMe="no"
continueShoppingURL="http://www.foxvalleycheesecake.com/store/cart.php"
cURL="PHP"
customerLogin="Y"
daysDefault="thirty"
declinedDefault="N"
displayDate="mm-dd-yyyy"
emailShipped="Y"
errorColor="red"
files="C:/Inetpub/wwwroot/store"
files_download="C:/Inetpub/wwwroot/downloads"
from="seo"
gateway=""
hasUploads="Y"
ignoreSave=""
installDate="2005=05-05"
invDontCart="N"
inventoryNotify="N"
invLowNotify=""
invOutAction="display"
invOutIcon="N"
invTrack="Y"
itemizeProductOptions="FALSE"
level3="Y"
limit="15"
locale="en_US"
locale.admin.date="en_US"
locale.showIntCurrSymbol="N"
lockTables="Y"
log.file=""
log.level="1028"
mAddress1="691 S. Green Bay Road"
mAddress2="Suite 120"
maxCcOrder="0.00"
maxHeight="300"
maxThumbHeight="125"
maxThumbWidth="125"
maxWidth="300"
mCity="Neenah"
mCompany="Verity IA, LLC"
mCountry="United States"
mEmail="kaye@foxvalleycheesecake.com"
merchantCountry="US"
merchantFromEmail="info@foxvalleycheesecake.com"
merchantLanguage="English"
merchantToEmail="info@foxvalleycheesecake.com"
merchantURL="http://www.foxvalleycheesecake.com/store"
minOrderAmt="10.00"
mName="Fox Valley Cheesecake"
mPhone="920-685-5806"
mState="WI"
mTitle=""
mURL="http://www.foxvalleycheesecake.com/store"
mZip="54963"
optionPrices="separate"
options="5"
orderDelete="N"
packingSlipFormat="A"
packingSlipX="-4"
packingSlipY="27"
payAmex="Y"
payCheck="N"
payCOD="N"
payCreditCard="Y"
payDinersClub="N"
payDiscover="Y"
payMasterCard="Y"
payMO="N"
payOther1="N"
payOther2="N"
payOtherName1=""
payOtherName2=""
payPalBusiness=""
payPalPost="https://www.paypal.com/cgi-bin/webscr"
payPayPal="N"
payVisa="Y"
pendingDefault="Y"
poBox="N"
productIMGpath="C:/Inetpub/wwwroot/images/products"
productIMGurl="images/products"
productWeight="LBS"
salesReportMargin="500"
searchEngineOptimization="N"
secure="C:/Inetpub/wwwroot/store"
secureURL="https://www.foxvalleycheesecake.com/store"
shippedDefault="N"
shippingTableSize="10"
shipQtyExtra="29.00"
shipQtyFirst="29.00"
shipQtyIntlExtra="9.00"
shipType="per-qty"
shipUPS="N"
shipUSPS="N"
taxComplete="Y"
taxCounties="25"
taxCountry="US"
taxScheme="entity"
testMode="N"
upsBillAcct="N"
upsClass="1"
upsCountry="US"
upsCountryLong="United States"
upsLicense=""
upsLicenseAPI="https://www.ups.com/ups.app/xml/License"
upsLicenseDev="6BA44A39B9276602"
upsPackage=""
upsPad="0"
upsPass=""
upsRateAPI="https://www.ups.com/ups.app/xml/Rate"
upsRegComplete="N"
upsRegisterAPI="https://www.ups.com/ups.app/xml/Register"
upsShipNum=""
upsSvcs=""
upsTrackAPI="https://www.ups.com/ups.app/xml/Track"
upsType=""
upsUser=""
upsUserKey=""
upsZip=""
uspsAPI="http://production.shippingapis.com/ShippingAPI.dll"
uspsDomSvcs=""
uspsIntlSvcs=""
uspsPad=""
uspsPass=""
uspsTestAPI="http://testing.shippingapis.com/ShippingAPItest.dll"
uspsUser=""
vendor=""
voidDefault="N"[/code]

[b]EDITED BY WILDTEEN88: Please use the code ([nobbc][code][/code][/nobbc]) or php ([nobbc][php][/php][/nobbc]) tags when including code in posts thank you.[/b]



Link to comment
Share on other sites

paths.inc.php as requested...
[code]
<?php

    error_reporting(E_ERROR | E_PARSE | E_USER_ERROR | E_USER_NOTICE);
    ini_set('display_errors', 1);

    /*
    * Sets the include path to the root directory and initializes the app config.
    */

    $settings = parse_ini_file(dirname(__FILE__) . '/config.app.root.ini.php');
    $sep = ( strstr( strtoupper( PHP_OS ), 'WIN' )  ) ? ';' : ':' ;

    ini_set('include_path' , ini_get('include_path') . $sep . $settings['app.root']);


    /*
    * Initialize the config;
    */

    if (!class_exists('SimpleConfig')) {
        require_once('lib/framework/SimpleConfig.class.php');
    }

    $config = SimpleConfig::getInstance();


    /*
    * Includes the commands so they'll be available everywhere.
    */
    require_once('lib/constants.commands.inc.php');
    require_once('lib/constants.inc.php');


    /*
    * Set up constants
    */
    if (!defined('TEST_MODE')) {
        define('TEST_MODE', ($config->getBoolValue('testMode')));
    }

    require_once('lib/framework/Util.class.php');

$self = Util::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

// Get rid of the parameters
$pattern = '/(.*)(\?.*)/i';
$replacement = '$1';
$self = preg_replace($pattern, $replacement, $self);

    define ('SELF', $self);

    /*
    * Set up the request object.
    */
    require_once('lib/framework/Request.class.php');
    $request = Request::getInstance();

?>
[/code]
Link to comment
Share on other sites

Hi again.

First you should try to modify the code in red cart.php to point to the path to your store(try both full or just http):
[code]define('VIEW_CART_URL', SELF . '?' . CMD_PARAM . '=' . VIEW_CART_CMD);
define('UPDATE_CART_URL', SELF . '?' . CMD_PARAM . '=' . CART_UPDATE_CMD);
[color=red]define('STORE_MAIN_URL', SELF)[/color];[/code]

Then try out the cart function.

If it does`nt work, and if ALL of the code required to run Digishop is not to large, send ALL of it to my e-mail, then i can run it on my own server, much easier to check the code in progress.

Best regards,

webmaster@eivindkrey.com
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.