cmsimple-xh / xhshop

A simple shop for CMSimple_XH
GNU General Public License v3.0
4 stars 3 forks source link

Support Shop-Page as first published page #204

Closed cmb69 closed 2 years ago

cmb69 commented 5 years ago

This is presently unsupported, but could likely be resolved by using $pd_s instead of $s in index.php.

manu37 commented 3 years ago

This is presently unsupported, but could likely be resolved by using $pd_s instead of $s in index.php.

This has to be checked by one of the gurus. After the suggested change and set the shop to the startpage, the update/delete cart wont run. I don't know why. $_POST is empty.

manu37 commented 3 years ago

This is presently unsupported, but could likely be resolved by using $pd_s instead of $s in index.php.

This has to be checked by one of the gurus. After the suggested change and set the shop to the startpage, the update/delete cart wont run. I don't know why. $_POST is empty.

manu37 commented 3 years ago

Mit dem https://github.com/cmsimple-xh/cmsimple-xh/issues/375 haben wir uns wohl in Knie geschossen. Ich bleib dran.

cmb69 commented 3 years ago

Mal als erster Ansatz:

 index.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/index.php b/index.php
index 829f5c7..aee80e2 100644
--- a/index.php
+++ b/index.php
@@ -66,11 +66,11 @@ if ($xhsController instanceof FrontEndController
     }

     // disable cartPreview (Button) also in print view (or fancybox)
-    if (!isset($_GET['xhsCheckout']) && (int)$s > -1 && !$print) {
+    if (!isset($_GET['xhsCheckout']) && (int)$pd_s > -1 && !$print) {
         $xhsCartPreview = $xhsController->cartPreview();

         if (!strpos(XH_readFile($pth['file']['template']), '$xhsCartPreview')) {
-            $c[$s] = $xhsController->cartPreview() . $c[$s];
+            $c[$pd_s] = $xhsController->cartPreview() . $c[$pd_s];
         }
     }

@@ -82,8 +82,8 @@ if ($xhsController instanceof FrontEndController
             $xhsCartButtons .= $xhsController->addToCartButton($product);
         }

-        if ($s >= 0) {
-             $c[$s] .= $xhsCartButtons;
+        if ($ps_s >= 0) {
+             $c[$pd_s] .= $xhsCartButtons;
             //$c[$s] =  preg_replace('/(<\/h[1-'.$cf['menu']['levels'].']>)/i', "$1 $xhsCartButtons", $c[$s], 1);
         }
     }
cmb69 commented 3 years ago

Und wohl auf jeden Fall abstrahieren (etwa isShopReqeuested()). Und XHS_URL muss wohl auch angepasst werden; ansonsten leitet CMSimple_XH weiter, und Post-Daten gehen verloren.

manu37 commented 3 years ago

Und wohl auf jeden Fall abstrahieren (etwa isShopReqeuested()). Und XHS_URL muss wohl auch angepasst werden; ansonsten leitet CMSimple_XH weiter, und Post-Daten gehen verloren.

Was möchtest Du abstrahiert haben? isset($_GET['xhsCheckout'])? XHS_URL umbiegen wäre eine einfache Möglichkeit. Aber dann bleibt das "?" im query stehen, unschön. Wie die ganze firstPublishedPage(), bei einer Zweitsprache aussieht, hat wohl auch noch niemand ausprobiert. Ich frage mich, ob man CmsBridge->translateUrl() dafür anpassen könnte.

cmb69 commented 3 years ago

Was möchtest Du abstrahiert haben? isset($_GET['xhsCheckout'])?

Ich meine, dass wir nicht an verschiedenen Stellen auf $s/ $pd_s oder welche Details auch immer prüfen sollten, sondern es eine Methode geben sollte, die prüft ob gerade die Shop-Seite aufgerufen wurde.

Ich frage mich, ob man CmsBridge->translateUrl() dafür anpassen könnte.

Ich denke, ja, und vermutlich ist das auch die richtige Stelle.