2011-05-10 16:32
New Quick.Cart v4.1 - release candidate 1. You can get this version from download here: http://opensolution.org/download/ You can test this version here: http://opensolution.org/Quick.Cart/v4.1/ Changes in this version are here: http://opensolution.org/download/Quick.Cart/changeLog.txt Bug fixes will be published with stable version If You will find bug, something unclear then write it here please! 1. THIS VERSION IS NOT STABLE!!! DON'T USE FOR COMMERCIAL USE, 2. We dont know sure when stable version will be released. It depends from users and tests. Maybe in 1-2 weeks.
2011-05-11 10:54
No fajna opcja sortowania. Możecie podać przepis na mod sortujący, o który uszlachetnił bym swoją wersję sklepu w wersji 4.0? Są to raczej drobne zmiany i nie bardzo chce mi się zmieniać cały sklep.
Q. C. 4.0 2011-05-11 12:09
Fajna rzecz z tym sortowaniem, również byłbym zainteresowany tylko tym dodatkiem. :)
Damian 2011-05-11 21:59
I hate to nag but the checkEmail function is still not fixed. Report here: http://opensolution.org/Quick.Cart/forum/?p=readTopic&nr=7187
http://cicmanec.sk/easyplugins/ 2011-05-12 19:27
Szydlo i korekkorek - poproscie makarona moze to zrobi :) beholder - i will not put this function in our script. we are talking about very few situations and we want add this to tips & tricks
2011-05-13 01:45
Good call.
http://cicmanec.sk/easyplugins/ 2011-05-13 09:58
eee pewnie makaron już go zrobił, tylko nie ma czasu udostępnić :)
Q. C. 4.0 2011-05-13 16:29
No to mnie treewood wrobił.. ;p No więc edytujecie plik core/products.php funkcja listProducts() i po linii:
if( isset( $aProducts ) ){
dodajecie taki kod:
$sSort = isset( $_GET [ 'sSort' ] ) ? $_GET [ 'sSort' ] : null ; if( isset( $sSort ) && !empty( $sSort ) && in_array ( $sSort , Array( 'price' , 'name' ) ) ){ $aProducts = $this -> sortProducts ( $aProducts , $sSort ); $sUrlExt .= '&sSort=' . $sSort ; } else $sSort = null ;
Jeszcze w tej samej funkcji pod linią:
$aData [ 'sHidePages' ] = ' hide' ;
dodajecie:
$aData [ 'sPageLinkName' ] = $oPage -> aPages [ $iContent ][ 'sLinkName' ]; if( isset( $GLOBALS [ 'sPhrase' ] ) && !empty( $GLOBALS [ 'sPhrase' ] ) ) $aData [ 'sPageLinkName' ] .= '&sPhrase=' . $GLOBALS [ 'sPhrase' ]; $oTpl -> setVariables ( 'aData' , $aData ); $aData [ 'sSortingProducts' ] = ( $GLOBALS [ 'config' ][ 'sorting_products' ] == true ) ? $oTpl -> tbHtml ( $sFile , 'SORTING_PRODUCTS' ) : null ;
W tym samym pliku zamieniacie funkcję sortProducts() na taką:
/** * Sort products * @return array * @param array $aProducts * @param string $sSort */ public function sortProducts ( $aProducts , $sSort ){ $iCount = count ( $aProducts ); $sFunctionSort = 'sort' ; if( $sSort == 'status' ){ $sKey = 'iStatus' ; } elseif( $sSort == 'price' ){ $sKey = 'mPrice' ; } elseif( $sSort == 'name' ){ $sKey = 'sName' ; } else{ $sFunctionSort = 'rsort' ; $sKey = 'iProduct' ; } for( $i = 0 ; $i < $iCount ; $i ++ ){ $mValue = $this -> aProducts [ $aProducts [ $i ]][ $sKey ]; $aSort [ $i ][ 0 ] = $mValue ; $aSort [ $i ][ 1 ] = $aProducts [ $i ]; } // end for $sFunctionSort ( $aSort ); for( $i = 0 ; $i < $iCount ; $i ++ ){ $aProducts [ $i ] = $aSort [ $i ][ 1 ]; } // end for return $aProducts ; } // end function sortProducts
Do pliku templates/pages_default.tpl dodajecie taki blok:
<!-- BEGIN SORTING_PRODUCTS --> < li class= "sort" id = "sortBefore" > $lang [ 'Sort_by' ]< div >< a href = "$aData['sPageLinkName']&sSort=" > $lang [ 'Default' ]</ a ></ div >|< div >& lt ; a href = "$aData['sPageLinkName']&sSort=name" > $lang [ 'Name' ]</ a ></ div >|< div >& l t ; a href = "$aData['sPageLinkName']&sSort=price" > $lang [ 'Price' ]</ a ></ div ></ li >< br /><!-- END SORTING_PRODUCTS -->
i w bloku <!-- BEGIN PRODUCTS_HEAD --> pod linią:
< ul id = "products" class= "productsList$config['display_products_list']" >
dodajecie:
$aData [ 'sSortingProducts' ]
W pliku config/general.php dodajecie:
$config [ 'sorting_products' ] = true ;
Już nie chcę mi się bawić, żeby ta zmienna była edytowalna w panelu admina.. W pliku lang/xx.php dodajecie:
$lang [ 'Sort_products' ] = "Sorting products option" ; $lang [ 'Sort_by' ] = "Sort by:" ; $lang [ 'Default' ] = "Default" ;
W pliku templates/default.css dodajecie:
#products li.sort{margin-right:10px;width:auto;border:0;background:inherit;color:#464032;} #products li.sort div{display:inline;padding:0 4px;}
Po tych krokach powinno grać. Trochę ich sporo. W ramach wdzięczności zachęcam do przeczytania stopki posta. ;p
I helped? Like it: www.facebook.com/makwebpl 2011-05-13 21:36
Dzięki bardzo. Wszystko pięknie śmiga. Wkradła się tylko literówka "wykrzaczająca" kod. w pliku templates/pages_default.tpl trza nieco zmodyfikować blok: <!-- BEGIN SORTING_PRODUCTS --> ja zrobiłem to tak: <!-- BEGIN SORTING_PRODUCTS --> <li class="sort" id="sortBefore">$lang['Sort_by']<div><a href="$aData['sPageLinkName']&sSort=">$lang['Default']</a></div>|<div> <a href="$aData['sPageLinkName']&sSort=name">$lang['Name']</a></div>|<div>&l t;a href="$aData['sPageLinkName']&sSort=price">$lang['Price']</a></div></li>& lt;br/> <!-- END SORTING_PRODUCTS --> reszta oki. Chciało by się jeszcze pokombinować z sortowaniem rosnąco, czy odwrotnie, ale to już raczej zbędne fanaberie. Mi wystarczy powyższy mod w 100% Co do podpięcia opcji do panelu admina, to gdzieś to miałem. Jutro jak będzie brzydka pogoda, to sobie podepnę. Gdyby ktoś potrzebował, to wrzucę i tu.
Q. C. 4.0 2011-05-14 07:34
No to mały dodatek: 'ascending-descending-Sort': (tylko jeśli zrobiliście zmiany wg Makarona lub jeśli macie QC4.1) W pierwszym dodatku:
$sSort=isset( $_GET [ 'sSort' ])? $_GET [ 'sSort' ]: null ; if(isset( $sSort )&&!empty( $sSort )&& in_array ( $sSort ,Array( 'price' , 'name' ))){ $aProducts = $this -> sortProducts ( $aProducts , $sSort ); $sUrlExt .= '&sSort=' . $sSort ; } else $sSort = null ;
pod linijką:
if(isset( $sSort )&&!empty( $sSort )&& in_array ( $sSort ,Array( 'price' , 'name' ))){
dodajemy:
if(!isset( $_COOKIE [ 'sSortVector' ])) @ setCookie ( 'sSortVector' , 'rsort' , 0 ); if(isset( $_COOKIE [ 'sSortVector' ])){ $sSortVector = $_COOKIE [ 'sSortVector' ]; if( $_COOKIE [ 'sSortVector' ]== 'rsort' ) @ setCookie ( 'sSortVector' , 'sort' , 0 ); elseif( $_COOKIE [ 'sSortVector' ]== 'sort' ) @ setCookie ( 'sSortVector' , 'rsort' , 0 ); }
i zamieniamy linijkę:
$aProducts= $this -> sortProducts ( $aProducts , $sSort );
na:
$aProducts= $this -> sortProducts ( $aProducts , $sSort , $sSortVector );
następnie w podmienionej funkcji sortProducts, dodajemy 1 parametr, czyli linijkę:
public function sortProducts ( $aProducts , $sSort ){
zamieniamy na:
public function sortProducts ( $aProducts , $sSort , $sSortVector = 'sort' ){
i dwie linijki niżej zaminiamy:
$sFunctionSort= 'sort' ;
na:
$sFunctionSort= $sSortVector ;
Dla posiadaczy wersji QC4.1: w funkcji sortProducts, pod linijką:
$sKey= 'mPrice' ;
skasować linijkę:
$sFunctionSort= 'rsort' ;
Działa tylko na komputerach, które przyjmują cookies.
http://it-service.kimla.de QC- & QCMS-plugins 2011-05-18 21:40
Właśnie zaadoptowałem sobie ten mod do palenu. Gdyby ktoś chciał również, to proszę: ======================== actions_admin\settings.php =============================== wklej: $sSortingProductsSelect = throwTrueFalseOrNullSelect( $config['sorting_products'] ); ================ config\general.php ====================== wklej: $config['sorting_products'] = true; & za fragmentem: define( 'WYSIWYG', $config['wysiwyg'] ); wklej: define( 'SORTINGPRODUCTS', $config['sorting_products'] ); ========================== templates\admin\settings.tpl =============================== najlepiej przed fragmentem: <!-- tab options --> wklej: <tr class="advanced"> <td> $lang['Sorting_products']</td> <td> <select name="sorting_products"> $sSortingProductsSelect </select> </td> </tr> ========= lang/pl.php =============== wklej: $lang['Sorting_products'] = "pokaż opcję Sortuj produkty"; ============================================== KONIEC ============================================== Nie wiem czy to "fachowo" zrobiłem, ale jak dla mnie wystarczy, bo działa. Standardowo jednak, przed modyfikacją zalecam najpierw zrobić backup sklepu ;-)
Q. C. 4.0