Jump to content



Latest News: (loading..)

foxp2

Member Since 27 Apr 2010
OFFLINE Last Active May 20 2013 08:22 PM
-----

Topics I've Started

osCommerce is always the ecommerce solution most deployed in the world

28 December 2012 - 12:56 PM

It is not I who says this, it is the 2013 open source guide :

Quote

Difficile de ne pas évoquer OsCommerce quand on parle de solution e-commerce open source. Cet outil, apparu dans sa première version en mars 2000, s'est rapidement imposé comme la solution incontournable en matière de e-commerce et comme porte-étendard de l’offre open source à une époque où elle était encore naissante.
Mais ces dernières années, cette communauté a commencé à se désolidariser de l'équipe de développement et a développé de nombreux « forks ». Le développement de la solution a fortement ralenti depuis 2006. Le code vieillissant rendant l'application très difficile à maintenir, l'équipe a entamé une refonte totale de l'outil et une V3 est sortie récemment après plusieurs années d’attente.
Diffusé sous licence GPL, OsCommerce est un outil reposant entièrement sur une communauté autrefois très large et très active.
Développé intégralement en PHP/MySQL, OsCommerce doit en grande partie son succès à l'absence d'alternatives dans le domaine open source et à l'explosion du e-business dans le début des années 2000. C'est encore aujourd'hui le webshop le plus déployé au monde.

PDF : http://www.smile.fr/Livres-blancs/Culture-du-web/Guide-de-l-open-source

Github Application

23 December 2012 - 11:49 AM

Hi all,

i'm just publishing my first Application for the new osCommerce 3 Website :

https://github.com/foxp2/github-application.

Installation :

:one: download this repo and dezip it where your osCommerce 3 [branch Template] & osCommerce Website are installed.

:two: Register on Github.com this application to generate OAuth tokens : Attached File  github-new-application.JPG   47.54K   20 downloads

Attached File  github-application-client-secret.JPG   54.54K   16 downloads

:three: open \osCommerce\OM\Config\settings.ini and add in [Website] section this three lines :

github_client_id = "52c4f4b3270d339eca76"
github_client_secret = "bce0d0861756fa144b1bdf0c1e848bb4d12303ca"
github_organization = "osCommerce"
be aware these client id & client secret  will not work ! (they have created for this tutorial and have been reseted)

:four: open \oscommerce_website\osCommerce\OM\Custom\Site\Website\Template\Amy\Content\base.html and this line ( before </head> ) :

<!-- added for github -->
<link rel="stylesheet" type="text/css" href="{publiclink}templates/default/stylesheets/github.css{publiclink}" />

:five: Enjoy !

if you like this App, don't forget to click on Like This button. Thanks !

{tag} Pagination for osCommerce Template Engine

15 December 2012 - 03:16 PM

hi,
i've coded a new {tag} for our Template Engine.
code :
<?php
/**
* osCommerce Website
*
* @[member='copyright'] Copyright (c) 2012 osCommerce; http://www.oscommerce.com
* @[member='copyright'] Copyright (c) 2012 FoxP2; http://www.oscommerce.fr
* @[member='licensed2kill'] BSD License; http://www.oscommerce.com/bsdlicense.txt
*/
  namespace osCommerce\OM\Core\Site\Website\Module\Template\Tag;
  use osCommerce\OM\Core\OSCOM;
  use osCommerce\OM\Core\Registry;
  class pagination extends \osCommerce\OM\Core\Template\TagAbstract {  
   
	static public function execute($string) {
	 
	  $OSCOM_Template = Registry::get('Template');
	 
	  $list = explode('|', $string);
	  $link = trim($list[0]);
	  $page = trim($list[1]);
	  $total_result = trim($list[2]);
	  $limit = trim($list[3]);
	  $step = trim($list[4]);	 
	  $paginationSize = trim($list[5]);
	  $paginationPosition = trim($list[6]);
	 
	  if ( isset($paginationSize) )  {
		switch($paginationSize) {
		  case 'large':
		  $size = "pagination-large";
		  break;
		  case 'mini':
		  $size = "pagination-mini";
		  break;
		  case 'small':
		  $size = "pagination-small";
		  break;
		  case 'normal':
		  $size = "";
		  break;
		}
	  }
	 
	  if ( isset($paginationPosition) )  {
		switch($paginationPosition) {
		  case 'right':
		  $position = "pagination-right";
		  break;
		  case 'center':
		  $position = "pagination-centered";
		  break;
		  case 'left':
		  $position = "";
		  break;
		}
	  }
	 
	  // Initial paging
	 if ( $page == 0 ){ $page = 1; }
	
	 $prev = $page - 1;
	
	 $next = $page + 1;
			
	 $last_page = ceil( $total_result / $limit );
	   
	 $latest_page = $last_page - 1;	

	 $pagination = '';
	
	 if( $last_page > 1 ) {
	  $pagination .= "<div class='pagination $size $position'>\n";
	 
	  $pagination .= "		<ul>\n";
	 
	  // Previous button
	if ( $page > (int)1 ){
	$pagination .= "		  <li class='active'><a href='$link&page=$prev'>" . OSCOM::getDef('previous') . "</a></li>\n";
	}else{
	$pagination .= "		  <li class='disabled'><span>" . OSCOM::getDef('previous') . "</span></li>\n";
	  }
	 
	  // Pages
	if ($last_page < (int)7 + ($step * (int)2)) {
	 for ($count_page = (int)1; $count_page <= $last_page; $count_page++ ) {
	
	  if ( $count_page == $page ) {
	   $pagination .= "		 <li class='disabled'><span>" . $count_page ."</span></li>\n";
	  }else{
	   $pagination .= "		 <li class='active'><a href='$link&page=$count_page'>" . $count_page . "</a></li>\n";		   
		  }	
	 }
	}elseif( $last_page > (int)5 + ( $step * (int)2 ) ) { 
		
	if( $page < (int)1 + ($step * (int)2) ) {
   
	for ( $count_page = (int)1; $count_page < (int)4 + ($step * (int)2); $count_page++ )  {
	 if ( $count_page == $page ){
	  $pagination .= "		  <li class='disabled'><span>$count_page</span></li>\n";
	 }else{
	  $pagination .= "		  <li class='active'><a href='$link&page=$count_page'>$count_page</a></li>\n";
		  }	
	}
   
	$pagination .= "		  <li class='disabled'><span>...</span></li>\n";
	$pagination .= "		  <li class='active'><a href='$link&page=$latest_page'>$latest_page</a></li>\n";
	$pagination .= "		  <li class='active'><a href='$link&page=$last_page'>$last_page</a></li>\n";
		 
   }
  
  
   elseif( $last_page - ($step * (int)2) > $page && $page > ($step * (int)2) ) {
  
	$pagination .= "		  <li class='active'><a href='$link&page=1'>1</a></li>\n";
	$pagination .= "		  <li class='active'><a href='$link&page=2'>2</a></li>\n";
	$pagination .= "		  <li class='disabled'><span>...</span></li>\n";
   
	for ( $count_page = $page - $step; $count_page <= $page + $step; $count_page++ )  {
	 if ( $count_page == $page )  {
	  $pagination .= "		  <li class='disabled'><span>$count_page</span></li>\n";
	 }else{
	  $pagination .= "		  <li class='active'><a href='$link&page=$count_page'>$count_page</a></li>\n";
		  }	
	}
   
	$pagination .= "		  <li class='disabled'><span>...</span></li>\n";
	$pagination .= "		  <li class='active'><a href='$link&page=$latest_page'>$latest_page</a></li>\n";
	$pagination .= "		  <li class='active'><a href='$link&page=$last_page'>$last_page</a></li>\n";
		 
   }  
   else
   {
	$pagination .= "		  <li class='active'><a href='$link&page=1'>1</a></li>\n";
	$pagination .= "		  <li class='active'><a href='$link&page=2'>2</a></li>\n";
	$pagination .= "		  <li class='disabled'><span>...</span></li>\n";
   
	for ( $count_page = $last_page - ((int)2 + ($step * (int)2)); $count_page <= $last_page; $count_page++ )  {
	   if ( $count_page == $page ){
		$pagination .= "		  <li class='disabled'><span>$count_page</span></li>\n";
	   }else{
		$pagination .= "		  <li class='active'><a href='$link&page=$count_page'>$count_page</a></li>\n";
			}	
	  }
	 }
	} 
	  // Next button
	 if ( $page < $last_page )  {
	  $pagination .= "		 <li class='active'><a href='$link&page=$next'>" . OSCOM::getDef('next') . "</a></li>\n";
	 }else{
	  $pagination .= "		 <li class='disabled'><span>" . OSCOM::getDef('next') . "</span></li>\n";
	 }
	
	  $pagination .= "		</ul>\n";
	  $pagination .= "	  </div>\n";
	 
	  }
	 
	  return $pagination;
	}
  }
?>

how to use it :

in View :
{pagination}{link}{link} | {value}page{value} | {value}total_result{value} | {value}result_per_page{value} | {value}nb_of_result_to_be_display{value} | small | center{pagination}

strange bug with link in {loop}

02 December 2012 - 07:58 AM

hi,

i get a strange bug.

when {loop} class parse a link with this pattern : "www.domain.com", it add "http://localhost/oscommerce_website"
if i add "http://" to the pattern, there is no problem.
found this issue with mark evans profile's.

in my code source, there is no problem ..

<li><i class="github-icon-wiki"></i><a href="www.freelancephp.co.uk" target="_blank">&nbsp;&nbsp;&nbsp;&nbsp;www.freelancephp.co.uk</a></li>  

:wacko:

Attached File  bug-link.png   172.42K   5 downloads

strange issue with {loop} tag.

23 November 2012 - 12:37 AM

hi,

in my app, github api returns dates with a format like 2009-02-25T13:58:38Z

i thought created a new tag to return a date with DateTime methods.

short code : \osCommerce\OM\Core\Template\Tag\dateformat.php

<?php
/**
* osCommerce Online Merchant
*
* @[member='copyright'] Copyright (c) 2012 osCommerce; http://www.oscommerce.com
* @[member='licensed2kill'] BSD License; http://www.oscommerce.com/bsdlicense.txt
*/
  namespace osCommerce\OM\Core\Template\Tag;

  use osCommerce\OM\Core\OSCOM;
  use osCommerce\OM\Core\Datetime;


  class dateformat extends \osCommerce\OM\Core\Template\TagAbstract {
 
	static protected $_parse_result = false;
  
	static public function execute($string) {
		return Datetime::getShort($string);   
	}
  }
?>

and used it in my loop :

{loop publicMember}
.../...
{dateformat}#created_at#{dateformat} 
.../...

it does not work ...

Quote

PHP Warning: mktime() expects parameter 6 to be long, string given in B:\UwAmp\www\oscommerce_website\osCommerce\OM\Core\DateTime.php on line 50

any idea ?