Dolphin Cart - Update Documentation/1.6 PHP Diff
From FMWebschool Reference
For information on reading this diff output please see http://en.wikipedia.org/wiki/Diff#Unified_format
Please note that some formatting on this page might be incorrect due to MediaWiki formatting, do not copy/paste from this page into your source code - find the changes within the PHP files of the release package and copy them from there. Use this page only as a reference.
Quick rules:
- Black lines are unchanged code, given to provide context
- Red lines are removed/edited lines
- Blue lines are new/replacement lines
Index: include/DolphinCart.class.php =================================================================== --- include/DolphinCart.class.php (release 1.5) +++ include/DolphinCart.class.php (release 1.6) @@ -123,11 +123,15 @@ if(!defined('HTTPS_URL')) { $url = str_replace('http://','https://',$url); }else{ - $url = HTTPS_URL.$localPath; + if(HTTPS_URL != ) { + $url = HTTPS_URL.$localPath; + }else{ + $url = $this->siteSettings['storeURL'].$localPath; + } } } return preg_replace('#(?<!:)//#','/',$url); - } + } function STR($stringName) { $stringName = strtoupper($stringName); @@ -317,7 +321,7 @@ function clearCache() { $items = scandir('templates/compiled/'); foreach($items as $item) { - if($item == '.' || $item == '..' || $item == 'config.inc.php') continue; + if(substr($item,0,1) == '.' || $item == 'config.inc.php') continue; unlink('templates/compiled/'.$item); } } Index: include/DolphinCartPro.class.php =================================================================== --- include/DolphinCartPro.class.php (release 1.5) +++ include/DolphinCartPro.class.php (release 1.6) @@ -204,13 +204,21 @@ } function listItems($category = null) { + if($category) $category = explode('|',$category); $page = $this->getPage(); $find = $this->cmd('find', 'cgi_ProductsMini'); $find->{'Dolphin Cart Settings::currentUser.global'} = $this->userId(); $find->isActive = '1'; $find->setPage($page, $this->getResultsPerPage()); $find->sort('productFlags','descending'); - if($category) $find->productCategory = $category; + if($category) { + if(count($category) == 1) { + $find->productCategory = $category[0]; + }else{ + $find->setScript('Category Search',implode("\r",$category)); + //$find->productCategory = $category[0]; + } + } $results = $find->execute(); if(!$results) return array(); $results = $this->cleanUpPrices($results); @@ -246,6 +254,7 @@ if(count($cat) > 1) { $cat_names[$category['categoryName']]['categoryName'] = str_repeat(' ',count($cat)-1).$cat[count($cat)-1]; $cat_names[$category['categoryName']]['categoryNameClean'] = $cat[count($cat)-1]; + $cat_names[$category['categoryName']]['level'] = count($cat); array_pop($cat); while(count($cat)) { $name = implode('//',$cat); @@ -254,16 +263,32 @@ 'categoryName'=>str_repeat(' ',count($cat)-1).$cat[count($cat)-1], 'categoryNameClean'=>$cat[count($cat)-1], 'categoryProductCount'=>0, + 'catIds'=>array($cat['categoryId']), + 'level'=>count($cat), ); } array_pop($cat); } }else{ $cat_names[$category['categoryName']]['categoryNameClean'] = $category['categoryName']; + $cat_names[$category['categoryName']]['level'] = 1; } } ksort($cat_names); + + foreach($cat_names as $key=>$value) { + if(!isset($value['catIds'])) $cat_names[$key]['catIds'] = array($value['categoryId']); + foreach($cat_names as $sub_key=>$sub_value) { + if($sub_key == $key || strpos($sub_key,$key) !== 0) continue; + $cat_names[$key]['categoryProductCount'] += $sub_value['categoryProductCount']; + $cat_names[$key]['catIds'][] = $sub_value['categoryId']; + } + $ids = $cat_names[$key]['catIds']; + foreach($ids as $id_key=>$id_value) if ($id_value == ) unset($ids[$id_key]); + $cat_names[$key]['categoryId'] = implode('|',$ids); + } + $this->categories = $cat_names; return $cat_names; Index: templates/Dolphin/header.htm =================================================================== --- templates/Dolphin/header.htm (release 1.5) +++ templates/Dolphin/header.htm (release 1.6) @@ -30,15 +30,24 @@ <td height="20" align="left" bgcolor="{$DOLPHIN->template.templateColor7}" class="categoryTitle">{S name=GENERAL_TEXT_CATEGORIES}</td> </tr> {if $DOLPHIN->siteSettings.storeRequireLogin != 'Yes' || $DOLPHIN->user() } + +<tr> +<td class="categorySelect" id="categories_list"> + +{assign var='last_level' value=0} {foreach from=$DOLPHIN->getCategories() item=categoryItem} - <tr> - <td class="categorySelect"><a href="{if $categoryItem.categoryProductCount}category.php?cat={$categoryItem.categoryId}{else}#{/if}"> +{if $categoryItem.level > $last_level}<ul>{else}</li>{/if} +{if $categoryItem.level < $last_level}</ul></li>{/if} +<li{if $category.categoryId && $category.categoryId == $categoryItem.categoryId} class="active"{/if}><a href="{if $categoryItem.categoryProductCount}category.php?cat={$categoryItem.categoryId}{else}#{/if}"> {if $category.categoryId && $category.categoryId == $categoryItem.categoryId}<strong>{/if} - {$categoryItem.categoryName} ({$categoryItem.categoryProductCount}) + {$categoryItem.categoryName|replace:" ":""} ({$categoryItem.categoryProductCount}) {if $category.categoryId && $category.categoryId == $categoryItem.categoryId}</strong>{/if} - </a></td> - </tr> +</a> +{assign var='last_level' value=`$categoryItem.level`} {/foreach} +</li></ul> +</td> +</tr> <tr><td> </td></tr> <tr><td> <form action="search.php" method="get"> Index: templates/Dolphin/card_entry.htm =================================================================== --- templates/Dolphin/card_entry.htm (release 1.5) +++ templates/Dolphin/card_entry.htm (release 1.6) @@ -28,7 +28,7 @@ {/if} <tr> <td align="right" class="productDesc">{S name=CHECKOUT_CARD_NUMBER}</td> - <td><input type="text" name="card_num" value="{$smarty.post.card_num}" /></td> + <td><input type="text" name="card_num" value="{$smarty.post.card_num}" autocomplete="false" /></td> </tr> <tr> <td align="right" class="productDesc">{S name=CHECKOUT_CARD_EXP}</td> @@ -46,7 +46,7 @@ </tr> <tr> <td align="right" class="productDesc">{S name=CHECKOUT_CARD_CVV}</td> - <td><input type="text" name="card_cvv" value="{$smarty.post.card_cvv}" /></td> + <td><input type="text" name="card_cvv" value="{$smarty.post.card_cvv}" autocomplete="false" /></td> </tr> <tr> <td align="right" class="productDesc">({S|nl2br name=CHECKOUT_CARD_CVV_TIP})</td> Index: templates/Dolphin/webstyle.css =================================================================== --- templates/Dolphin/webstyle.css (release 1.5) +++ templates/Dolphin/webstyle.css (release 1.6) @@ -68,6 +68,37 @@ .categorySelect a { font-size: 80%; } + +.categorySelect ul { + margin: 0px; + padding: 0px; + list-style-type: none; +} + +.categorySelect ul span { + display: block; + width: 20px; + text-align: center; + clear: none; + margin: 0px; + padding: 0px; + float: left; + cursor: pointer; +} + +.categorySelect li { + padding-top: 6px; +} + +.categorySelect ul ul { + padding-bottom: 6px; + padding-left: 10px; +} + +.categorySelect ul ul.closed { + display: none; +} + INPUT { font-family:Arial, Helvetica, sans-serif; font-size: 8pt; } SELECT { Index: templates/Dolphin/checkout_options_internal.htm =================================================================== --- templates/Dolphin/checkout_options_internal.htm (release 1.5) +++ templates/Dolphin/checkout_options_internal.htm (release 1.6) @@ -10,7 +10,7 @@ <tr> <td valign="top"><table width="480" border="0" cellspacing="0" cellpadding="2"> {foreach from=$DOLPHIN->paymentSystems item=payment} -{if !$payment->isExternal()} +{if !$payment->isExternal() || true} <tr> <td colspan="3" class="checkoutOption">{$payment->printPaymentForm()}</td> </tr> Index: templates/Dolphin/cart_fragment.htm =================================================================== --- templates/Dolphin/cart_fragment.htm (release 1.5) +++ templates/Dolphin/cart_fragment.htm (release 1.6) @@ -79,7 +79,7 @@ <td> <input name="action" id="formAction" value="updateCart" type="hidden"></td> <td valign="top"> </td> <td valign="top"> </td> - <td colspan="2" align="right" valign="bottom" class="menuLinks"><a href="checkout.php">{S name=CART_ACTION_CHECKOUT}</a></td> + <td colspan="2" align="right" valign="bottom" class="menuLinks"><input type="button" value="{S name=CART_ACTION_CHECKOUT}" onclick="javascript:document.location.href='checkout.php';" /></td> </tr> {/if} {else} Index: templates/Dolphin/checkout_options.htm =================================================================== --- templates/Dolphin/checkout_options.htm (release 1.5) +++ templates/Dolphin/checkout_options.htm (release 1.6) @@ -9,17 +9,17 @@ <table width="500" border="1" align="center" cellpadding="10" cellspacing="0"> <tr> <td valign="top"><table width="480" border="0" cellspacing="0" cellpadding="2"> -{assign var=externalOnly value=true} +{assign var=externalOnly value=1} {foreach from=$DOLPHIN->paymentSystems item=payment} {if $payment->isExternal()} <tr> <td colspan="3" class="checkoutOption">{$payment->printPaymentForm()}</td> </tr> {else} -{assign var=externalOnly value=false} +{assign var=externalOnly value=0} {/if} {/foreach} -{if $extrnalOnly != true} +{if $externalOnly != 1} {include file="checkout.htm"} {/if} </table> Index: templates/Dolphin/js/functions.js =================================================================== --- templates/Dolphin/js/functions.js (release 1.5) +++ templates/Dolphin/js/functions.js (release 1.6) @@ -15,4 +15,53 @@ $('bill_country').value = $F('ship_country'); $('bill_phone').value = $F('ship_phone'); $('bill_email').value = $F('ship_email'); -} \ No newline at end of file +} + +function setupCategories() { + var categories = $('categories_list'); + if(!categories) return; + + var node = categories.firstDescendant(); + + setupCategories_Node(node); +} + +function setupCategories_Node(node) { + var children = node.immediateDescendants(); + var collapses = false; + children.each(function(child) { + if(child.tagName == 'UL') { + var toggle = new Element('span').update('+'); + if(child.parentNode.hasClassName('active') || child.descendants().detect(function(e){return e.hasClassName('active');})) { + toggle.update('-'); + }else{ + child.addClassName('closed'); + } + child.parentNode.insertBefore(toggle,child.parentNode.firstDescendant()); + + collapses = true; + setupCategories_Node(child); + Event.observe(toggle,'click',categoryToggleClick); + }else if(child.tagName == 'LI') { + setupCategories_Node(child); + } + }); + if(node.tagName == 'LI' && !collapses) { + var toggle = new Element('span').update(' '); + node.insertBefore(toggle,node.firstDescendant()); + } +} + +function categoryToggleClick(evt) { + var toggle = evt.target; + if(toggle.innerHTML == '+') { + toggle.update('-'); + toggle.parentNode.select('ul').first().removeClassName('closed'); + }else{ + toggle.update('+'); + toggle.parentNode.select('ul').first().addClassName('closed'); + } +} + + +Event.observe(window,'load',setupCategories); \ No newline at end of file Index: setup/setup.js =================================================================== --- setup/setup.js (release 1.5) +++ setup/setup.js (release 1.6) @@ -84,6 +84,7 @@ params = params.merge($('siteForm').serialize(true)); params = params.merge($('emailForm').serialize(true)); + $('smtpVerify_code').value = Math.random(); var ajax = new Ajax.Request( 'ajax.php', { @@ -93,12 +94,13 @@ if(data.error != undefined) return ajax_error(data); $('smtpVerify_code').value = data.code; - $('smtpVerify').show(); - $('smtpVerify').scrollTo(); alert('A verification code has been sent to: '+$F('storeEmail')); }, - asynchronous: false + asynchronous: true }); + + $('smtpVerify').show(); + $('smtpVerify').scrollTo(); return false; } Index: VERSION.TXT =================================================================== --- VERSION.TXT (release 1.5) +++ VERSION.TXT (release 1.6) @@ -1 +1 @@ -Dolphin Cart Pro v1.5.0 - Apr 05, 2008 \ No newline at end of file +Dolphin Cart Pro v1.6.0 - July 09, 2008 \ No newline at end of file Index: modules/payment/FMWS_ManualInvoice/FMWS_ManualInvoice.class.php =================================================================== --- modules/payment/FMWS_ManualInvoice/FMWS_ManualInvoice.class.php (release 1.5) +++ modules/payment/FMWS_ManualInvoice/FMWS_ManualInvoice.class.php (release 1.6) @@ -25,7 +25,7 @@ function printPaymentForm() { global $DOLPHIN; - $form = new FMWS_SIMPLE_FORM($DOLPHIN->getURL('/card_entry.php',true)); + $form = new FMWS_SIMPLE_FORM($DOLPHIN->getURL('/card_entry.php',false)); $form->addHidden('submitURL', $this->action()); $form->addHidden('invoice_num', $this->invoice); $form->addHidden('action', 'card_submit');

