コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    製品デモを利用する
  • 料金
  • ヘルプ

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • 会計
  • 在庫
  • PoS
  • プロジェクト
  • MRP
All apps
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
ヘルプ

How could I add "previouS" and "next" button in my products page?

購読

この投稿に活動があった際に通知を受け取ります

この質問にフラグが付けられました
shopproductpreviousnextnavigation
2 返信
8322 ビュー
アバター
Pascal Tremblay

Hello all,

our shop is great on odoo 8.  All works very well!  

But once in a product page, how could we add a previous and next button to allow navigation in the products pages?

thansk for your tip!

0
アバター
破棄
Pascal Tremblay
著作者

A little up here!!!! Somebody would have a solution already for this?

アバター
Pascal Tremblay
著作者 最善の回答

Here is our solution to get those two buttons on a product page. With those buttons, you can navigate through all the products of the active selected category. Buttons becomes disabled when no product before or after in the category.


Result :




Template :

<template id="website.previous_and_next" name="Previous and next">

<div id="previous_and_next_iv" t-if="pager_pt['products_count'] > 1">

<a

t-att-class=" 'btn btn-primary pull-left mt10 mb10 disabled' if pager_pt['product']['num'] == 0 else 'btn btn-primary pull-left mt10 mb10' "

t-att-href="pager_pt['product_previous']['url']" >

Previous product in this category</a>

<a

t-att-class=" 'btn btn-primary pull-right mt10 mb10 disabled' if pager_pt['product']['num'] == pager_pt['products_count'] else 'btn btn-primary pull-right mt10 mb10' "

t-att-href="pager_pt['product_next']['url']" >

Next product in this category</a>

</div>

</template>



Where you want to put the buttons :

<template id="website_sale.product" name="Product">

<t t-call="website.layout">

[...]

<div class="row previous_and_next_iv">

<t t-call="website.previous_and_next" />

</div>

[...]

</template>



Python code to override :


class website_sale_all(website_sale):

@http.route(['/shop/product/<model("product.template"):product>'], type='http', auth="public", website=True)

def product(self, product, category='', search='', **kwargs):

cr, uid, context, pool = request.cr, request.uid, request.context, request.registry

category_obj = pool['product.public.category']

template_obj = pool['product.template']

context.update(active_id=product.id)

if category:

category = category_obj.browse(cr, uid, int(category), context=context)

category = category if category.exists() else False

attrib_list = request.httprequest.args.getlist('attrib')

attrib_values = [map(int,v.split("-")) for v in attrib_list if v]

attrib_set = set([v[1] for v in attrib_values])

keep = QueryURL('/shop', category=category and category.id, search=search, attrib=attrib_list)

category_ids = category_obj.search(cr, uid, [], context=context)

category_list = category_obj.name_get(cr, uid, category_ids, context=context)

category_list = sorted(category_list, key=lambda category: category[1])

pricelist = self.get_pricelist()

from_currency = pool.get('product.price.type')._get_field_currency(cr, uid, 'list_price', context)

to_currency = pricelist.currency_id

compute_currency = lambda price: pool['res.currency']._compute(cr, uid, from_currency, to_currency, price, context=context)

domain = self._get_search_domain(search, category, attrib_values)

url = "/shop/product"

product_obj = pool.get('product.template')

product_count = product_obj.search_count(cr, uid, domain, context=context)

product_ids = product_obj.search(cr, uid, domain, limit=200, order='website_published desc, website_sequence desc', context=context)

if category:

cat_id = category.id

else:

cat_id = ''

pager_pt = request.website.pager_pt(active_product=product.id, products=product_ids, active_category=cat_id)

products = product_obj.browse(cr, uid, product_ids, context=context)

if not context.get('pricelist'):

context['pricelist'] = int(self.get_pricelist())

product = template_obj.browse(cr, uid, int(product), context=context)

values = {

'search': search,

'category': category,

'pager_pt': pager_pt,

'pricelist': pricelist,

'attrib_values': attrib_values,

'compute_currency': compute_currency,

'attrib_set': attrib_set,

'keep': keep,

'category_list': category_list,

'main_object': product,

'product': product,

'get_attribute_value_ids': self.get_attribute_value_ids

}

return request.website.render("website_sale.product", values)


from openerp.addons.website.models.website import website

class website_iv(osv.osv):

_inherit = "website"

def pager_pt(self, cr, uid, active_product, products, active_category, context=None):

products_count = len(products)

num_product = products.index(active_product)

num_previous = num_product - 1

num_next = num_product + 1

num_min = 0

num_max = products_count - 1

def get_url(id):

if active_category:

_url = "/shop/product/%s?category=%s" % (id, active_category) #if page > 1 else url

else:

_url = "/shop/product/%s" % (id)

return _url

retour = {

"products_count": products_count - 1,

"product": {

#'url': 'asdfasdF', #get_url(active_product),

'num': num_product

},

"product_previous": {

'url': get_url(products[max(num_previous, num_min)]),

'num': num_previous

},

"product_next": {

'url': get_url(products[min(num_next, num_max)]),

'num': num_next

},

}

return retour



4
アバター
破棄
ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
Select products with 3 shops on the same database (V18)
shop product
アバター
0
10月 25
523
Shop by Cities or Countries on Webpage
shop product
アバター
0
4月 16
3521
403: Forbidden The page you were looking for could not be authorized.
shop product
アバター
アバター
1
3月 15
1012
Price list by packaging
configuration shop product
アバター
アバター
アバター
2
11月 25
267
Customise the display of prices on the main page in online store
shop product price
アバター
0
11月 24
1645
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • Github
  • Runbot
  • 翻訳
サービス
  • Odoo.shホスティング
  • サポート
  • アップグレード
  • カスタム開発
  • 教育プログラム
  • 会計事務所一覧
  • パートナー一覧
  • パートナーになる
企業情報
  • 会社概要
  • ブランドアセット
  • お問い合わせ
  • 採用情報
  • イベント
  • ポッドキャスト
  • ブログ
  • お客様一覧
  • リーガル情報 • プライバシーポリシー
  • セキュリティ
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo(オドゥー)は、CRM、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now