<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Little.ws &#187; ブロック</title>
	<atom:link href="http://little.ws/tag/%e3%83%96%e3%83%ad%e3%83%83%e3%82%af/feed" rel="self" type="application/rss+xml" />
	<link>http://little.ws</link>
	<description>web制作とかcssとかデザインとか色々～な覚え書き</description>
	<lastBuildDate>Sat, 04 Feb 2012 07:27:16 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>EC-cube：カゴの中ブロックに商品名や商品写真を表示させる</title>
		<link>http://little.ws/200908/249.html</link>
		<comments>http://little.ws/200908/249.html#comments</comments>
		<pubDate>Mon, 10 Aug 2009 14:59:27 +0000</pubDate>
		<dc:creator>chibi</dc:creator>
				<category><![CDATA[EC-cube]]></category>
		<category><![CDATA[カート]]></category>
		<category><![CDATA[ブロック]]></category>

		<guid isPermaLink="false">http://little.ws/?p=249</guid>
		<description><![CDATA[調べて出てきた情報が古かったので、Forumのramrun様をリスペクトしてここに覚え書きしときます。 元記事を読んで分からないときにだけお読み下さい。 あくまでもコピペ+改良版です。1系をお使いの方はフォーラムをご覧下&#8230;]]></description>
			<content:encoded><![CDATA[<p>調べて出てきた情報が古かったので、Forumのramrun様をリスペクトしてここに覚え書きしときます。<br />
<a href="http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=384&#038;post_id=1657&#038;order=0&#038;viewmode=flat&#038;pid=0&#038;forum=5" class="liexternal">元記事</a>を読んで分からないときにだけお読み下さい。<br />
<strong>あくまでもコピペ+改良版です。1系をお使いの方はフォーラムをご覧下さい。</strong><br />
<span id="more-249"></span><br />
ソース見にくいですがソース右上のクリップボードにコピーとか色々試して見て下さい。</p>
<h4>/bloc/cart.tplブロックファイル</h4>
<p>これもフォーラムのじゃちょっと動きがおかしかったので少し編集してます。</p>
<pre class="brush: php; title: ; notranslate">
&lt;!--{*
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*}--&gt;
&lt;!--▼現在のカゴの中ここから--&gt;
&lt;div class=&quot;sb-base&quot;&gt;

&lt;!--★タイトル★--&gt;
&lt;h4&gt;&lt;img src=&quot;&lt;!--{$smarty.const.URL_DIR}--&gt;img/side/title_cartin.jpg&quot; alt=&quot;現在のカゴの中&quot; /&gt;&lt;/h4&gt;

&lt;div class=&quot;sb-main&quot;&gt;
&lt;div class=&quot;sb-content&quot;&gt;

&lt;!--★商品点数★--&gt;
  &lt;div&gt;&lt;span class=&quot;fs10&quot;&gt;商品数：&lt;!--{$arrCartList.0.TotalQuantity|number_format|default:0}--&gt;点&lt;/span&gt;&lt;/div&gt;

 &lt;!--{if $arrCartList.0.TotalQuantity &gt; 0}--&gt;
&lt;form name=&quot;form2&quot; id=&quot;form2&quot; method=&quot;post&quot; action=&quot;&lt;!--{$smarty.const.URL_DIR}--&gt;frontparts/bloc/cart_delitem.php&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;mode&quot; value=&quot;delete&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;cart_no&quot; value=&quot;&quot; /&gt;
&lt;!--{section name=cnt loop=$arrCartList}--&gt;
&lt;div style=&quot;margin-bottom:5px&quot;&gt;
&lt;!--★商品画像★--&gt;
&lt;div style=&quot;width:50px;float:left&quot;&gt;&lt;a href=&quot;&lt;!--{$smarty.const.URL_DIR}--&gt;cart/index.php&quot;&gt;
 //↓rewrited by chibiの覚え書き
&lt;img src=&quot;&lt;!--{$smarty.const.SITE_URL}--&gt;resize_image.php?image=&lt;!--{$arrCartList[cnt].img}--&gt;&amp;width=48&amp;height=48&quot; alt=&quot;&lt;!--{$arrCartList[cnt].product_name|escape}--&gt;&quot; /&gt;
&lt;/a&gt;&lt;/div&gt;

&lt;div style=&quot;width:95px;float:right&quot;&gt;
&lt;!--★商品名★--&gt;
&lt;div style=&quot;color:#4a6fa6;font-size:14px&quot;&gt;
&lt;strong&gt;&lt;!--{$arrCartList[cnt].product_name|escape}--&gt;&lt;/strong&gt;
&lt;/div&gt;

&lt;!--★販売価格×数量★--&gt;
&lt;div style=&quot;text-align:right;font-size:12px&quot;&gt;
&lt;!--{$arrCartList[cnt].price|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format|default:0}--&gt;円×&lt;!--{$arrCartList[cnt].quantity|escape}--&gt;
&lt;a href=&quot;&lt;!--{$smarty.const.URL_DIR}--&gt;frontparts/bloc/cart_delitem.php&quot; onclick=&quot;fnFormModeSubmit('form2', 'delete', 'cart_no', '&lt;!--{$arrCartList[cnt].cart_no}--&gt;'); return false;&quot;&gt;&lt;img src=&quot;&lt;!--{$smarty.const.URL_DIR}--&gt;img/contents/icon_delete.jpg&quot; alt=&quot;この商品の購入を取り消す&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;br style=&quot;clear:both&quot; /&gt;
&lt;/div&gt;
&lt;!--{/section}--&gt;
&lt;/form&gt;
&lt;!--{/if}--&gt;
&lt;!--★区切り線★--&gt;
&lt;hr /&gt;
&lt;!--★合計★--&gt;
&lt;div style=&quot;margin-bottom:5px;text-align:right&quot;&gt;
&lt;span class=&quot;redst&quot;&gt;&lt;span class=&quot;fs14&quot;&gt;合計：&lt;!--{$arrCartList.0.ProductsTotal|number_format|default:0}--&gt;円&lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;!--★カゴの中に商品がある場合にのみ表示★--&gt;
&lt;!--{if $arrCartList.0.TotalQuantity &gt; 0 and $arrCartList.0.free_rule &gt; 0}--&gt;
&lt;div style=&quot;margin-bottom:10px&quot;&gt;
&lt;span class=&quot;fs10&quot;&gt;
&lt;!--{if $arrCartList.0.deliv_free &gt; 0}--&gt;
送料手数料無料まであと&lt;!--{$arrCartList.0.deliv_free|number_format|default:0}--&gt;円（税込）です。
&lt;!--{else}--&gt;
現在、送料は「&lt;span class=&quot;redst&quot;&gt;無料&lt;/span&gt;」です。
&lt;!--{/if}--&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;!--{/if}--&gt;
&lt;!--★ボタン★--&gt;
&lt;div style=&quot;margin-top:5px;text-align:center&quot;&gt;
&lt;a href=&quot;&lt;!--{$smarty.const.URL_DIR}--&gt;cart/index.php&quot; onmouseover=&quot;chgImg('&lt;!--{$smarty.const.URL_DIR}--&gt;img/side/button_cartin_on.gif','button_cartin');&quot; onmouseout=&quot;chgImg('&lt;!--{$smarty.const.URL_DIR}--&gt;img/side/button_cartin.gif','button_cartin');&quot;&gt;&lt;img src=&quot;&lt;!--{$smarty.const.URL_DIR}--&gt;img/side/button_cartin.gif&quot; alt=&quot;カゴの中を見る&quot; name=&quot;button_cartin&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sb-bottom&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!--▲現在のカゴの中ここまで--&gt;
</pre>
<h4>data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Cart.php</h4>
<p>フォーラムではeccube/html/frontparts/bloc/cart.phpとなっているファイルですが、2系ではdata/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Cart.phpこのファイルを編集。<br />
編集する場所はここ！！のとこでｗ</p>
<pre class="brush: php; title: ; notranslate">
if (count($_SESSION[$objCart-&gt;key]) &gt; 0){
// カート情報を取得
$arrCartList = $objCart-&gt;getCartList();

// カート内の商品ＩＤ一覧を取得
$arrAllProductID = $objCart-&gt;getAllProductID();
// 商品が1つ以上入っている場合には商品名称を取得
if (count($arrAllProductID) &gt; 0){
	$objQuery = new SC_Query();
	$arrVal = array();
	$sql = &quot;&quot;;
   //↓ここ！！！
	$sql = &quot;SELECT product_id,name,main_list_image FROM dtb_products WHERE product_id IN ( ?&quot;;
	$arrVal = array($arrAllProductID[0]);
	for($i = 1 ; $i &lt; count($arrAllProductID) ; $i++){
	$sql.= &quot; ,? &quot;;
	array_push($arrVal, $arrAllProductID[$i]);
}
$sql.= &quot; )&quot;;
 //↓ここから！！！
$arrProduct_list = $objQuery-&gt;getAll($sql, $arrVal);

$item_list = array();
for($i = 0; $i &lt; count($arrProduct_list); $i++){
$item_list[$arrProduct_list[$i]['product_id']]['name'] = $arrProduct_list[$i]['name'];
$item_list[$arrProduct_list[$i]['product_id']]['main_list_image'] = $arrProduct_list[$i]['main_list_image'];
}
for($i = 0; $i &lt; count($arrCartList); $i++){
$arrCartList[$i]['product_name'] = $item_list[$arrCartList[$i]['id'][0]]['name'];
$arrCartList[$i]['img'] = $item_list[$arrCartList[$i]['id'][0]]['main_list_image'];
}
//↑ここまで！！！
}
// 店舗情報の取得
$arrInfo = $objSiteInfo-&gt;data;
// 購入金額合計
$ProductsTotal = $objCart-&gt;getAllProductsTotal($arrInfo);

// 合計個数
$TotalQuantity = $objCart-&gt;getTotalQuantity();1

// 送料無料までの金額
$arrCartList[0]['ProductsTotal'] = $ProductsTotal;
$arrCartList[0]['TotalQuantity'] = $TotalQuantity;
$deliv_free = $arrInfo['free_rule'] - $ProductsTotal;
$arrCartList[0]['free_rule'] = $arrInfo['free_rule'];
$arrCartList[0]['deliv_free'] = $deliv_free;

$objSubPage-&gt;arrCartList = $arrCartList;
//↓ここ！！！
$objSubPage-&gt;arrInfo = $arrInfo;
}
</pre>
<h4>/html/frontparts/bloc/cart_delitem.php</h4>
<p>ファイルを新規に作成</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

require_once(&quot;../../require.php&quot;);

$objCartSess = new SC_CartSession(&quot;&quot;, false);

switch($_POST['mode']) {
case 'up':
    $objCartSess-&gt;upQuantity($_POST['cart_no']);
    header(&quot;Location: &quot; . URL_DIR);
    break;
case 'down':
    $objCartSess-&gt;downQuantity($_POST['cart_no']);
    header(&quot;Location: &quot; . URL_DIR);
    break;
case 'delete':
    $objCartSess-&gt;delProduct($_POST['cart_no']);
    header(&quot;Location: &quot; . URL_DIR);
    break;
default:
    header(&quot;Location: &quot; . URL_DIR);
    break;
}

?&gt;
</pre>
<p>以上で出来ると思います。<br />
ちなみに、フォーラムに書いてある、eccube/html/products/list.phpとeccube/html/products/detail.phpは編集しなくてもいいと思ったので見てません。<br />
というか、編集前にテストしたら全然問題ないので見てませんｗ<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://little.ws/200908/249.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

