カテゴリー: 開発メモ
OpenPNE3.8のイイネプラグイン
何故か本文にイイネを付けられなかったので。
<!--Like Plugin --> <div class="like" style="display: none;"> <span class="like-wrapper" data-like-id="<?php echo $communityTopic->getId() ?>" data-like-target="A" member-id="<?php echo $communityTopic->member_id ?>"> <span class="like-post">いいね!</span> <span class="like-cancel">いいね!を取り消す </span> <span class="like-you">あなたが「いいね!」と言っています。</span><br /> <a class="like-list" href="#likeModal" data-toggle="modal"></a> <div class="like-list-member"></div> <span class="like-friend-list"></span> </span> </div>
これをshowSuccess.phpに書くと良い
OpenPNEでメール無差別送付
opCommunityTopicToolKit.class.php
内の
<blockquote>if ($r->getIsReceiveMailPc() && $memberPcAddress)</blockquote> <blockquote>if ($r->getIsReceiveMailMobile() && $memberMobileAddress)</blockquote>
これを
<blockquote>if ($memberPcAddress)</blockquote> <blockquote>if ($memberMobileAddress)
こうすればいいね!
EC-CUBEにVIP会員だけ購入可能な機能を付加したい その2
テンプレートに手を入れるだけでいけるんじゃね?
と勘違いしたおかげで遠回りしてしまった。
Smartyに渡る変数で、追加に必要なのは
限定商品フラグ
VIP会員フラグ
の 二種が必要なのでやっぱdetail.phpをいじらなければいけない。
結局テンプレートもこのフラグで分岐させな駄目ですけどね!
以下メモ
$search = 99; //商品ステータス
$key = in_array($search, $objPage->productStatus[2]);
$objPage->tpl_products_vip = true;
if ($key){
// 商品ステータスがみつかったのでVIP判定をする
$objCustomer = new SC_Customer();
//顧客ステータスから会員情報を判定して会員ならtrue
$customoer_status = $objCustomer->getValue('status');
if ($customer_status == 9){
$objPage->tpl_customer_vip = true;
}else{
//
}
EC-CUBEでの会員ランク。 | 青い月の光の中で悪魔と踊るかい?
EC-CUBEにVIP会員だけ購入可能な機能を付加したい その1
やったこと
- 商品ステータスを適当に設定する
- 会員状態を適当に設定する
- 商品ステータスを元に商品詳細ページでは限定商品かどうか判定する
- VIP判定はまたこんど
今日はここまで。
ちなみに/html/products/detail.php が
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// {{{ requires
require_once '../require.php';
require_once CLASS_EX_REALDIR . 'page_extends/products/LC_Page_Products_Detail_Ex.php';
// }}}
// {{{ generate page
$objPage = new LC_Page_Products_Detail_Ex();
register_shutdown_function(array($objPage, 'destroy'));
$objPage->init();
//商品IDを元に限定フラグの確認
SC_Utils::sfPrintR( $objPage->productStatus );
$search = 99; //商品ステータス
$key = in_array($search, $objPage->productStatus[2]);
if ($key){
// 商品ステータスがみつかったのでVIP判定をする
$objCustomer = new SC_Customer();
if($objCustomer->isLoginSuccess()) {
$this->tpl_login = true;
}
}else{
//
}
$objPage->process();
/data/class_extends/page_extends/products/
class LC_Page_Products_Detail_Ex extends LC_Page_Products_Detail {
// }}}
// {{{ functions
/** 各商品のステータス */
var $productStatus;
/** 商品ステータス設定 */
var $arrSTATUS;
/** 商品ステータス画像 */
var $arrSTATUS_IMAGE;
/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
$masterData = new SC_DB_MasterData_Ex();
$this->arrSTATUS = $masterData->getMasterData("mtb_status");
$this->arrSTATUS_IMAGE = $masterData->getMasterData("mtb_status_image");
$this->productStatus = $this->lfGetProductStatus();
}
/**
* Page のプロセス.
*
* @return void
*/
function process() {
parent::process();
}
function lfGetProductStatus(){
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objProduct = new SC_Product_Ex();
// おすすめ商品取得
$col = 'product_id';
$table = 'dtb_best_products';
$where = 'del_flg = 0';
$objQuery->setOrder('rank');
$objQuery->setLimit(RECOMMEND_NUM);
$arrBestProducts = $objQuery->select($col, $table, $where);
$objQuery =& SC_Query_Ex::getSingletonInstance();
if (count($arrBestProducts) > 0) {
// 商品一覧を取得
// where条件生成&セット
$arrProductId = array();
$where = 'product_id IN (';
foreach ($arrBestProducts as $key => $val) {
$arrProductId[] = $val['product_id'];
}
// 商品ステータスを設定
$objProduct->setProductsClassByProductIds($arrProductId);
$productStatus = $objProduct->getProductStatus($arrProductId);
}
return $productStatus;
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}
phpList での日本語メール送信メモ
最近phpListを使う機会があったのでTips書いておきますね。
ちなみにversion 2.10.19 だそうです。
主にテキストでメールを送信する場合に起る2点です。
- 半角スペースで勝手に改行される問題
- やたら行間があく問題
勝手に改行されるのはwordwrapが効いてるからのようです。
TEXT送信=レガシーな環境向けという思想からだとおもうんですが、日本語環境化では不自然な状態で改行されることがあるのでおもいきってコメントアウトしてみました。
lists/admin/sendemaillib.php
$text = wordwrap($text,70); ↓ //$text = wordwrap($text,70);
それからやたら行間が空くのは<br>タグの変換時に改行コードを挿入してくれるからみたいです。上記ファイルの少し上部分の
$text = preg_replace(“/<br[^>]*?>/i”,”<br>\n”,$text);
の”\n”を外すといいかんじになります。
【モデル利用】Django 初心者がコミュニティサイト的な何かにチャレンジしてみる – 謎言語使いの世迷事
from django.contrib.auth.models import User